code: def _dispatch(self, typ):
          
          for can_handle, handler in self._handler_pairs:
              # can handle could raise an exception here
              # such as issubclass being called on an instance.
              # it's easier to just ignore that case.
              try:
                  if can_handle(typ):
                      return handler
              except Exception:
                  pass
          raise KeyError("unable to find handler for {0}".format(typ))
docs: returns the appropriate handler, for the object passed.