docstr: Get integer location, slice or boolean mask for requested label.
  
  Parameters
  ----------
  key : label
  
  Returns
  -------
  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 a point inside an interval.
  
  >>> 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([i1, i2, i3])
  >>> overlapping_index.get_loc(0.5)
  array([ True, False,  True])
  
  Only exact matches will be returned if an interval is provided.
  
  >>> index.get_loc(pd.Interval(0, 1))
  0
docstr_tok: ["Get","integer","location",",","slice","or","boolean","mask","for","requested","label",".","Parameters","--","--","--","--","--","key",":","label","Returns","--","--","--","-","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","a","point","inside","an","interval",".",">",">",">","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","(","[","i1",",","i2",",","i3","]",")",">",">",">","overlapping_index.get_loc","(","0.5",")","array","(","[","True",",","False",",","True","]",")","Only","exact","matches","will","be","returned","if","an","interval","is","provided",".",">",">",">","index.get_loc","(","pd.Interval","(","0",",","1",")",")","0"]
code: def get_loc(self, key) -> int | slice | np.ndarray:
      """
      Get integer location, slice or boolean mask for requested label.
  
      Parameters
      ----------
      key : label
  
      Returns
      -------
      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 a point inside an interval.
  
      >>> 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([i1, i2, i3])
      >>> overlapping_index.get_loc(0.5)
      array([ True, False,  True])
  
      Only exact matches will be returned if an interval is provided.
  
      >>> index.get_loc(pd.Interval(0, 1))
      0
      """
      self._check_indexing_error(key)
  
      if isinstance(key, Interval):
          if self.closed != key.closed:
              raise KeyError(key)
          mask = (self.left == key.left) & (self.right == key.right)
      elif is_valid_na_for_dtype(key, self.dtype):
          mask = self.isna()
      else:
          # assume scalar
          op_left = le if self.closed_left else lt
          op_right = le if self.closed_right else lt
          try:
              mask = op_left(self.left, key) & op_right(key, self.right)
          except TypeError as err:
              # scalar is not comparable to II subtype --> invalid label
              raise KeyError(key) from err
  
      matches = mask.sum()
      if matches == 0:
          raise KeyError(key)
      if matches == 1:
          return mask.argmax()
  
      res = lib.maybe_booleans_to_slice(mask.view("u1"))
      if isinstance(res, slice) and res.stop is None:
          # TODO: DO this in maybe_booleans_to_slice?
          res = slice(res.start, len(self), res.step)
      return res
  
imports: from __future__ import annotations
  from operator import le, lt
  import textwrap
  from typing import TYPE_CHECKING, Any, Literal
  import numpy
  from pandas._libs import lib
  from pandas._libs.interval import Interval, IntervalMixin, IntervalTree
  from pandas._libs.tslibs import BaseOffset, Period, Timedelta, Timestamp, to_offset
  from pandas.errors import InvalidIndexError
  from pandas.util._decorators import Appender, cache_readonly
  from pandas.util._exceptions import rewrite_exception
  from pandas.core.dtypes.cast import find_common_type, infer_dtype_from_scalar, maybe_box_datetimelike, maybe_downcast_numeric, maybe_upcast_numeric_to_64bit
  from pandas.core.dtypes.common import ensure_platform_int, is_float_dtype, is_integer, is_integer_dtype, is_list_like, is_number, is_object_dtype, is_scalar, pandas_dtype
  from pandas.core.dtypes.dtypes import DatetimeTZDtype, IntervalDtype
  from pandas.core.dtypes.missing import is_valid_na_for_dtype
  from pandas.core.algorithms import unique
  from pandas.core.arrays.datetimelike import validate_periods
  from pandas.core.arrays.interval import IntervalArray, _interval_shared_docs
  import pandas.core.common
  from pandas.core.indexers import is_valid_positional_slice
  import pandas.core.indexes.base
  from pandas.core.indexes.base import Index, _index_shared_docs, ensure_index, maybe_extract_name
  from pandas.core.indexes.datetimes import DatetimeIndex, date_range
  from pandas.core.indexes.extension import ExtensionIndex, inherit_names
  from pandas.core.indexes.multi import MultiIndex
  from pandas.core.indexes.timedeltas import TimedeltaIndex, timedelta_range
label_desc: Use image node_id 18 for calling the IntervalIndex obj's underlying member method code with example usage: obj.get_loc(key) and returns: res, mask