docs: def _handle_entity(self, token):
          """Handle a case where an HTML entity is at the head of the tokens."""
          token = self._tokens.pop()
          if isinstance(token, tokens.HTMLEntityNumeric):
              token = self._tokens.pop()
              if isinstance(token, tokens.HTMLEntityHex):
                  text = self._tokens.pop()
                  self._tokens.pop()  # Remove HTMLEntityEnd
                  return HTMLEntity(text.text, named=False, hexadecimal=True,
                                    hex_char=token.char)
              self._tokens.pop()  # Remove HTMLEntityEnd
              return HTMLEntity(token.text, named=False, hexadecimal=False)
          self._tokens.pop()  # Remove HTMLEntityEnd
          return HTMLEntity(token.text, named=True, hexadecimal=False)