code: def _obj_to_path(obj):
    
    if obj is None:
      return obj
  
    if inspect.isclass(obj) or inspect.isfunction(obj):
      fetched = getattr(sys.modules[obj.__module__], obj.__name__, None)
      if fetched is None:
        raise ValueError(
            "Object %r must be defined on the top level of a module." % obj)
      return "%s.%s" % (obj.__module__, obj.__name__)
    raise TypeError("Unexpected type %s." % type(obj))
docs: Returns the fully qualified path to the object.
  
    Args:
      obj: obj must be a new style top level class, or a top level function.
        No inner function or static method.
  
    Returns:
      Fully qualified path to the object.
  
    Raises:
      TypeError: when argument obj has unsupported type.
      ValueError: when obj can't be discovered on the top level.