code: def getrec(self, name, include_self=True, *default):
          
          for node in self.iter_up(include_self):
              try:
                  return getattr(node, name)
              except AttributeError: pass
              
          if default:
              return default[0]
          else:
              raise AttributeError(name)
docs: Look up an attribute in the path to the root.