import requests


def get_docket(auth_token, docket_number, court_name, client_matter="", cached=True, normalize=True):
    """
    Takes in an authentication token as a string,
    a docket number as a string, and the court name as a string,
    and returns the docket data as a dictionary.

    Optional parameters are client_matter, Cached, and normalize.

    Cached is True by default. If turned to false, the most recent docket data will be fetched directly,
    this can result in extra charges. set cached to False if you are having trouble retrieving data for a docket.

    Normalize normalizes the names of parties when possible.
    """

    # We specify the endpoint we will be making the api call to.
    endpoint = "https://www.docketalarm.com/api/v1/getdocket/"

    # We set the parameters we will send to the endpoint in a dictionary.
    # These values come from the arguments that are passed to this function.
    params = {
        'login_token':auth_token,
        'client_matter':client_matter,
        'court':court_name,
        'docket':docket_number,
        'cached':cached,
        'normalize':normalize,
    }

    # we make the api call and store the result in a variable.
    # We use the .json() method to convert the result to a python dictionary.
    result = requests.get(endpoint, params, timeout=60).json()

    # We return the results of the API call as a dictionary.
    return result