def get_locs(self, seq):
from .numeric import Int64Index<EOL>true_slices = [i for (i, s) in enumerate(com.is_true_slices(seq)) if s]<EOL>if true_slices and true_slices[-<NUM_LIT:1>] >= self.lexsort_depth:<EOL><INDENT>raise UnsortedIndexError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>.format(true_slices, self.lexsort_depth))<EOL><DEDENT>n = len(self)<EOL>indexer = None<EOL>def _convert_to_indexer(r):<EOL><INDENT>if isinstance(r, slice):<EOL><INDENT>m = np.zeros(n, dtype=bool)<EOL>m[r] = True<EOL>r = m.nonzero()[<NUM_LIT:0>]<EOL><DEDENT>elif com.is_bool_indexer(r):<EOL><INDENT>if len(r) != n:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT:index>")<EOL><DEDENT>r = r.nonzero()[<NUM_LIT:0>]<EOL><DEDENT>return Int64Index(r)<EOL><DEDENT>def _update_indexer(idxr, indexer=indexer):<EOL><INDENT>if indexer is None:<EOL><INDENT>indexer = Index(np.arange(n))<EOL><DEDENT>if idxr is None:<EOL><INDENT>return indexer<EOL><DEDENT>return indexer & idxr<EOL><DEDENT>for i, k in enumerate(seq):<EOL><INDENT>if com.is_bool_indexer(k):<EOL><INDENT>k = np.asarray(k)<EOL>indexer = _update_indexer(_convert_to_indexer(k),<EOL>indexer=indexer)<EOL><DEDENT>elif is_list_like(k):<EOL><INDENT>indexers = None<EOL>for x in k:<EOL><INDENT>try:<EOL><INDENT>idxrs = _convert_to_indexer(<EOL>self._get_level_indexer(x, level=i,<EOL>indexer=indexer))<EOL>indexers = (idxrs if indexers is None<EOL>else indexers | idxrs)<EOL><DEDENT>except KeyError:<EOL><INDENT>continue<EOL><DEDENT><DEDENT>if indexers is not None:<EOL><INDENT>indexer = _update_indexer(indexers, indexer=indexer)<EOL><DEDENT>else:<EOL><INDENT>return Int64Index([])._ndarray_values<EOL><DEDENT><DEDENT>elif com.is_null_slice(k):<EOL><INDENT>indexer = _update_indexer(None, indexer=indexer)<EOL><DEDENT>elif isinstance(k, slice):<EOL><INDENT>indexer = _update_indexer(_convert_to_indexer(<EOL>self._get_level_indexer(k, level=i, indexer=indexer)),<EOL>indexer=indexer)<EOL><DEDENT>else:<EOL><INDENT>indexer = _update_indexer(_convert_to_indexer(<EOL>self.get_loc_level(k, level=i, drop_level=False)[<NUM_LIT:0>]),<EOL>indexer=indexer)<EOL><DEDENT><DEDENT>if indexer is None:<EOL><INDENT>return Int64Index([])._ndarray_values<EOL><DEDENT>return indexer._ndarray_values<EOL>
Get location for a given label/slice/list/mask or a sequence of such as
an array of integers.

Parameters
----------
seq : label/slice/list/mask or a sequence of such
   You should use one of the above for each level.
   If a level should not be used, set it to ``slice(None)``.

Returns
-------
locs : array of integers suitable for passing to iloc

Examples
---------
>>> mi = pd.MultiIndex.from_arrays([list('abb'), list('def')])

>>> mi.get_locs('b')
array([1, 2], dtype=int64)

>>> mi.get_locs([slice(None), ['e', 'f']])
array([1, 2], dtype=int64)

>>> mi.get_locs([[True, False, True], slice('e', 'f')])
array([2], dtype=int64)

See Also
--------
MultiIndex.get_loc : Get location for a label or a tuple of labels.
MultiIndex.slice_locs : Get slice location given start label(s) and
                        end label(s).