def get_loc(self, key, method=None):
self._check_method(method)<EOL>original_key = key<EOL>key = self._maybe_cast_indexed(key)<EOL>if self.is_non_overlapping_monotonic:<EOL><INDENT>if isinstance(key, Interval):<EOL><INDENT>left = self._maybe_cast_slice_bound(key.left, '<STR_LIT:left>', None)<EOL>right = self._maybe_cast_slice_bound(key.right, '<STR_LIT:right>', None)<EOL>key = Interval(left, right, key.closed)<EOL><DEDENT>else:<EOL><INDENT>key = self._maybe_cast_slice_bound(key, '<STR_LIT:left>', None)<EOL><DEDENT>start, stop = self._find_non_overlapping_monotonic_bounds(key)<EOL>if start is None or stop is None:<EOL><INDENT>return slice(start, stop)<EOL><DEDENT>elif start + <NUM_LIT:1> == stop:<EOL><INDENT>return start<EOL><DEDENT>elif start < stop:<EOL><INDENT>return slice(start, stop)<EOL><DEDENT>else:<EOL><INDENT>raise KeyError(original_key)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>key = self._maybe_convert_i8(key)<EOL>if isinstance(key, Interval):<EOL><INDENT>left, right = _get_interval_closed_bounds(key)<EOL>return self._engine.get_loc_interval(left, right)<EOL><DEDENT>else:<EOL><INDENT>return self._engine.get_loc(key)<EOL><DEDENT><DEDENT>
Get integer location, slice or boolean mask for requested label.

        Parameters
        ----------
        key : label
        method : {None}, optional
            * default: matches where the label is within an interval only.

        Returns
        -------
        loc : int if unique index, slice if monotonic index, else mask

        Examples
        ---------
        >>> i1, i2 = pd.Interval(0, 1), pd.Interval(1, 2)
        >>> index = pd.IntervalIndex([i1, i2])
        >>> index.get_loc(1)
        0

        You can also supply an interval or an location for a point inside an
        interval.

        >>> index.get_loc(pd.Interval(0, 2))
        array([0, 1], dtype=int64)
        >>> index.get_loc(1.5)
        1

        If a label is in several intervals, you get the locations of all the
        relevant intervals.

        >>> i3 = pd.Interval(0, 2)
        >>> overlapping_index = pd.IntervalIndex([i2, i3])
        >>> overlapping_index.get_loc(1.5)
        array([0, 1], dtype=int64)