def do_ams_get_url(endpoint, access_token, flag=True):
headers = {"<STR_LIT:Content-Type>": json_acceptformat,<EOL>"<STR_LIT>": dsversion_min,<EOL>"<STR_LIT>": dsversion_max,<EOL>"<STR_LIT>": json_acceptformat,<EOL>"<STR_LIT>" : charset,<EOL>"<STR_LIT>": "<STR_LIT>" + access_token,<EOL>"<STR_LIT>" : xmsversion}<EOL>body = '<STR_LIT>'<EOL>response = requests.get(endpoint, headers=headers, allow_redirects=flag)<EOL>if flag:<EOL><INDENT>if response.status_code == <NUM_LIT>:<EOL><INDENT>response = requests.get(response.headers['<STR_LIT:location>'], data=body, headers=headers)<EOL><DEDENT><DEDENT>return response<EOL>
Do an AMS GET request to retrieve the Final AMS Endpoint and return JSON.
    Args:
        endpoint (str): Azure Media Services Initial Endpoint.
        access_token (str): A valid Azure authentication token.
        flag  (str): A Flag to follow the redirect or not.

    Returns:
        HTTP response. JSON body.