code: def index(self, type_: Type[T]) -> int:
          
          for i, cond in ((q[0], q[1][0]) for q in enumerate(self.handlers)):
              try:
                  match = cond(type_)
              except:
                  if self.raiseconditionerrors:
                      raise
                  match = False
              if match:
                  return i
          raise ValueError('No matching condition found')
docs: Returns the index in the handlers list
          that matches the given type.
  
          If no condition matches, ValueError is raised.