def GetModulePath(obj):
  """Returns the module path string for obj, None if its builtin.

  The module path is relative and importable by ImportModule() from any
  installation of the current release.

  Args:
    obj: The object to get the module path from.

  Returns:
    The module path name for obj if not builtin else None.
  """
  try:
    # An object either has a module ...
    module = obj.__module__
  except AttributeError:
    # ... or it has a __class__ that has a __module__.
    obj = obj.__class__
    module = obj.__module__
  if module.startswith('__builtin__'):
    return None
  path = '.' + module
  part = '.googlecloudsdk.'  # This factors out the current installation dir.
  i = path.find(part)
  path = path[i + len(part):] if i >= 0 else module
  try:
    return path + '.' + obj.__name__
  except AttributeError:
    try:
      return path + '.' + obj.__class__.__name__
    except AttributeError:
      return None