def groupby(self, values):
<EOL>if isinstance(values, ABCMultiIndex):<EOL><INDENT>values = values.values<EOL><DEDENT>values = ensure_categorical(values)<EOL>result = values._reverse_indexer()<EOL>result = {k: self.take(v) for k, v in result.items()}<EOL>return result<EOL>
Group the index labels by a given array of values.

Parameters
----------
values : array
    Values used to determine the groups.

Returns
-------
groups : dict
    {group name -> group labels}