import requests


def query_graphql(query, variables, token):
    """Query GitHub's GraphQL API with the given query and variables.
    The response JSON always has a "data" key; its value is returned
    as a dictionary."""
    header = {"Authorization": f"token {token}"}
    r = requests.post("https://api.github.com/graphql",
            json={"query": query, "variables": variables}, headers=header)
    r.raise_for_status()
    return r.json()["data"]