def _is_label_or_level_reference(self, key, axis=0):
    '\n        Test whether a key is a label or level reference for a given axis.\n\n        To be considered either a label or a level reference, `key` must be a\n        string that:\n          - (axis=0): Matches a column label or an index level\n          - (axis=1): Matches an index label or a column level\n\n        Parameters\n        ----------\n        key: str\n            Potential label or level name\n        axis: int, default 0\n            Axis that levels are associated with (0 for index, 1 for columns)\n\n        Returns\n        -------\n        is_label_or_level: bool\n        '
    if (self.ndim > 2):
        raise NotImplementedError('_is_label_or_level_reference is not implemented for {type}'.format(type=type(self)))
    return (self._is_level_reference(key, axis=axis) or self._is_label_reference(key, axis=axis))
Test whether a key is a label or level reference for a given axis.

To be considered either a label or a level reference, `key` must be a
string that:
  - (axis=0): Matches a column label or an index level
  - (axis=1): Matches an index label or a column level

Parameters
----------
key: str
    Potential label or level name
axis: int, default 0
    Axis that levels are associated with (0 for index, 1 for columns)

Returns
-------
is_label_or_level: bool
def _is_label_or_level_reference(self, key, axis=0):
    '\n        Test whether a key is a label or level reference for a given axis.\n\n        To be considered either a label or a level reference, `key` must be a\n        string that:\n          - (axis=0): Matches a column label or an index level\n          - (axis=1): Matches an index label or a column level\n\n        Parameters\n        ----------\n        key: str\n            Potential label or level name\n        axis: int, default 0\n            Axis that levels are associated with (0 for index, 1 for columns)\n\n        Returns\n        -------\n        is_label_or_level: bool\n        '
    if (self.ndim > 2):
        raise NotImplementedError('_is_label_or_level_reference is not implemented for {type}'.format(type=type(self)))
    return (self._is_level_reference(key, axis=axis) or self._is_label_reference(key, axis=axis))