docs: def get_named_parent(decl):
      """
      Returns a reference to a named parent declaration.
  
      Args:
          decl (declaration_t): the child declaration
  
      Returns:
          declaration_t: the declaration or None if not found.
  
      """
  
      if not decl:
          return None
  
      parent = decl.parent
      while parent and (not parent.name or parent.name == '::'):
          parent = parent.parent
      return parent