def _get_nested_attr(obj, name):
  """Get an attribute that may or may not be nested within an object.

  This will get an attribute of obj or or an attribute that is in an object
  that is in obj.

  Args:
      obj (object): The object to check for the attribute with the given name.
      name (str): The name of the attribute to get. name can be either an
        attribute of obj or an object.attribute where object is part of obj.

  Returns:
      object: The method or property that may have been nested inside of other
      objects.
  """
  attr_list = name.split('.')
  for attr in attr_list:
    obj = getattr(obj, attr, None)
  return obj