code: def getattrd(obj, name, default=sentinel):
      
      try:
          return functools.reduce(getattr, name.split("."), obj)
      except AttributeError as e:
          if default is not sentinel:
              return default
          raise
docs: Same as getattr(), but allows dot notation lookup
      Source: http://stackoverflow.com/a/14324459