code: def form(self) -> Optional['HTMLFormElement']:
          
          if self.__form:
              return self.__form
          parent = self.parentNode
          while parent:
              if isinstance(parent, HTMLFormElement):
                  return parent
              else:
                  parent = parent.parentNode
          return None
docs: Get ``HTMLFormElement`` object related to this node.