docs: def do_ams_get_url(endpoint, access_token, flag=True):
      '''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.
      '''
      headers = {"Content-Type": json_acceptformat,
                 "DataServiceVersion": dsversion_min,
                 "MaxDataServiceVersion": dsversion_max,
                 "Accept": json_acceptformat,
                 "Accept-Charset" : charset,
                 "Authorization": "Bearer " + access_token,
                 "x-ms-version" : xmsversion}
      body = ''
      response = requests.get(endpoint, headers=headers, allow_redirects=flag)
      if flag:
          if response.status_code == 301:
              response = requests.get(response.headers['location'], data=body, headers=headers)
      return response