def _drop_labels_or_levels(self, keys, axis=<NUM_LIT:0>):
if self.ndim > <NUM_LIT:2>:<EOL><INDENT>raise NotImplementedError(<EOL>"<STR_LIT>"<EOL>.format(type=type(self)))<EOL><DEDENT>axis = self._get_axis_number(axis)<EOL>keys = com.maybe_make_list(keys)<EOL>invalid_keys = [k for k in keys if not<EOL>self._is_label_or_level_reference(k, axis=axis)]<EOL>if invalid_keys:<EOL><INDENT>raise ValueError(("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>.format(axis=axis,<EOL>invalid_keys=invalid_keys))<EOL><DEDENT>levels_to_drop = [k for k in keys<EOL>if self._is_level_reference(k, axis=axis)]<EOL>labels_to_drop = [k for k in keys<EOL>if not self._is_level_reference(k, axis=axis)]<EOL>dropped = self.copy()<EOL>if axis == <NUM_LIT:0>:<EOL><INDENT>if levels_to_drop:<EOL><INDENT>dropped.reset_index(levels_to_drop, drop=True, inplace=True)<EOL><DEDENT>if labels_to_drop:<EOL><INDENT>dropped.drop(labels_to_drop, axis=<NUM_LIT:1>, inplace=True)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if levels_to_drop:<EOL><INDENT>if isinstance(dropped.columns, MultiIndex):<EOL><INDENT>dropped.columns = dropped.columns.droplevel(levels_to_drop)<EOL><DEDENT>else:<EOL><INDENT>dropped.columns = RangeIndex(dropped.columns.size)<EOL><DEDENT><DEDENT>if labels_to_drop:<EOL><INDENT>dropped.drop(labels_to_drop, axis=<NUM_LIT:0>, inplace=True)<EOL><DEDENT><DEDENT>return dropped<EOL>
Drop labels and/or levels for the given `axis`.

For each key in `keys`:
  - (axis=0): If key matches a column label then drop the column.
    Otherwise if key matches an index level then drop the level.
  - (axis=1): If key matches an index label then drop the row.
    Otherwise if key matches a column level then drop the level.

Parameters
----------
keys: str or list of str
    labels or levels to drop
axis: int, default 0
    Axis that levels are associated with (0 for index, 1 for columns)

Returns
-------
dropped: DataFrame

Raises
------
ValueError
    if any `keys` match neither a label nor a level