code: def getattrs(value, attrs, default=_no_default):
      """
      Perform a chained application of ``getattr`` on ``value`` with the values
      in ``attrs``.
  
      If ``default`` is supplied, return it if any of the attribute lookups fail.
  
      Parameters
      ----------
      value : object
          Root of the lookup chain.
      attrs : iterable[str]
          Sequence of attributes to look up.
      default : object, optional
          Value to return if any of the lookups fail.
  
      Returns
      -------
      result : object
          Result of the lookup sequence.
  
      Examples
      --------
      >>> class EmptyObject(object):
      ...     pass
      ...
      >>> obj = EmptyObject()
      >>> obj.foo = EmptyObject()
      >>> obj.foo.bar = "value"
      >>> getattrs(obj, ('foo', 'bar'))
      'value'
  
      >>> getattrs(obj, ('foo', 'buzz'))
      Traceback (most recent call last):
         ...
      AttributeError: 'EmptyObject' object has no attribute 'buzz'
  
      >>> getattrs(obj, ('foo', 'buzz'), 'default')
      'default'
      """
      try:
          for attr in attrs:
              value = getattr(value, attr)
      except AttributeError:
          if default is _no_default:
              raise
          value = default
      return value
  
file_path: zipline/zipline/utils/functional.py
imports: from functools import reduce
  from operator import itemgetter
  from pprint import pformat
  from six import viewkeys, iteritems
  from six.moves import map, zip
  from toolz import curry, flip
  from .sentinel import sentinel
label_desc: Use image node_id 8 for calling a global function with example usage: getattrs(value, attrs, default) and returns: value