code: def get_parent(self, level=1):
          '''
          get parent dir as a `DirectoryInfo`.
  
          return `None` if self is top.
          '''
          try:
              parent_path = self.path.get_parent(level)
          except ValueError: # abspath cannot get parent
              return None
          assert parent_path
          return DirectoryInfo(parent_pathf get_parent(self, level=1):
          '''
          get parent dir as a `DirectoryInfo`.
  
          return `None` if self is top.
          '''
          try:
              parent_path = self.path.get_parent(level)
          except ValueError: # abspath cannot get parent
              return None
          assert parent_path
          return DirectoryInfo(parent_path)
docs: get parent dir as a `DirectoryInfo`.
  
          return `None` if self is top.