import requests


def query_endpoint(username, **kwargs):
    """
    Args:
        username (str): Lichess username
        kwargs (dict): Any of the query parameters for the Lichess
            apiGamesUser API user endpoint.

    Keyword Args:
        All Lichess API endpoint parameters are allowed, see Reference
        notes.

    Returns:
        (requests.response)

    References:
        https://lichess.org/api#operation/apiGamesUser

    Note:
        Consider implimenting streaming as suggested but Lichess API notes:
        https://requests.readthedocs.io/en/master/user/advanced/#streaming-requests
    """
    return requests.get(
        url=f"https://lichess.org/api/games/user/{username}",
        params=kwargs,
    )