def _gotitem(self,<EOL>key: Union[str, List[str]],<EOL>ndim: int,<EOL>subset: Optional[Union[Series, ABCDataFrame]] = None,<EOL>) -> Union[Series, ABCDataFrame]:
if subset is None:<EOL><INDENT>subset = self<EOL><DEDENT>elif subset.ndim == <NUM_LIT:1>:  <EOL><INDENT>return subset<EOL><DEDENT>return subset[key]<EOL>
Sub-classes to define. Return a sliced object.

Parameters
----------
key : string / list of selections
ndim : 1,2
    requested ndim of result
subset : object, default None
    subset to act on