import types


def _get_object_config(obj):
  """Return the object's config depending on string, function, or others."""
  if isinstance(obj, str):
    # Use the content of the string as the config for string.
    return obj
  elif isinstance(obj, types.FunctionType):
    # Keep track of the function's module and name in a dict as the config.
    return {
        'module': obj.__module__,
        'function_name': obj.__name__,
    }
  if not hasattr(obj, 'get_config'):
    raise TypeError(f'Unable to recognize the config of {obj}.')
  return obj.get_config()