code: def find_in_sorted_index(dts, dt):
      """
      Find the index of ``dt`` in ``dts``.
  
      This function should be used instead of `dts.get_loc(dt)` if the index is
      large enough that we don't want to initialize a hash table in ``dts``. In
      particular, this should always be used on minutely trading calendars.
  
      Parameters
      ----------
      dts : pd.DatetimeIndex
          Index in which to look up ``dt``. **Must be sorted**.
      dt : pd.Timestamp
          ``dt`` to be looked up.
  
      Returns
      -------
      ix : int
          Integer index such that dts[ix] == dt.
  
      Raises
      ------
      KeyError
          If dt is not in ``dts``.
      """
      ix = dts.searchsorted(dt)
      if ix == len(dts) or dts[ix] != dt:
          raise LookupError(
              "{dt} is not in {dts}".format(dt=dt, dts=dts)
          )
      return ix
  
imports: from contextlib import contextmanager
  from copy import deepcopy
  from itertools import product
  import operator
  import warnings
  import numpy
  import pandas
  from distutils.version import StrictVersion
  from trading_calendars.utils.pandas_utils import days_at_time
label_desc: Use image node_id 5 for calling a global function with example usage: find_in_sorted_index(dts, dt) and returns: ix