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