code: def parse_extension_item_param(
      header: str, pos: int, header_name: str
  ) -> Tuple[ExtensionParameter, int]:
      
      # Extract parameter name.
      name, pos = parse_token(header, pos, header_name)
      pos = parse_OWS(header, pos)
      # Extract parameter value, if there is one.
      value: Optional[str] = None
      if peek_ahead(header, pos) == "=":
          pos = parse_OWS(header, pos + 1)
          if peek_ahead(header, pos) == '"':
              pos_before = pos  # for proper error reporting below
              value, pos = parse_quoted_string(header, pos, header_name)
              # https://tools.ietf.org/html/rfc6455#section-9.1 says: the value
              # after quoted-string unescaping MUST conform to the 'token' ABNF.
              if _token_re.fullmatch(value) is None:
                  raise InvalidHeaderFormat(
                      header_name, "invalid quoted header content", header, pos_before
                  )
          else:
              value, pos = parse_token(header, pos, header_name)
          pos = parse_OWS(header, pos)
  
      return (name, value), pos
docs: Parse a single extension parameter from ``header`` at the given position.
  
      Return a ``(name, value)`` pair and the new position.
  
      Raise :exc:`~websockets.exceptions.InvalidHeaderFormat` on invalid inputs.