code: def get_outermost(
      obj, attr, default=SENTINEL, nested_lookup_fn=get_nested_objs
  ):
      """Return a (nested) attribute value.
  
      The first attribute found is returned. Nested objects are traversed
      breadth-first, with level-wise order determined by the list ordering returned
      from `nested_lookup_fn`.
  
      Args:
        obj: The object to find (nested) attributes in.
        attr: A `string` attribute name to search for.
        default: If `attr` does not exist in `obj` or nested objects, and `default`
          is set, return `default`.
        nested_lookup_fn: A single-argument callable that returns a list of
          (attribute name, nested object) pairs. Defaults to `get_nested_objs`.
  
      Returns:
        value: The (nested) attribute value, or `default` if it does not exist and
          `default` is set.
  
      Raises:
        AttributeError: if `attr` is not found and `default` is not specified.
      """
      to_visit = collections.deque([obj])
      while to_visit:
          nested = to_visit.popleft()
          to_visit.extend(
              (nested for _, nested in nested_lookup_fn(nested))
          )
          try:
              return getattr(nested, attr)
          except AttributeError:
              pass
      if default is not SENTINEL:
          return default
      raise AttributeError(
          "No attribute `"
          + attr
          + "` in nested results of "
          + str(obj.__class__)
      )
  
file_path: probability/tensorflow_probability/python/internal/unnest.py
imports: import collections
label_desc: Use image node_id 4 for calling a global function with example usage: get_outermost(obj, attr, default, nested_lookup_fn) and returns: default, getattr