docs: def do_ams_patch(endpoint, path, body, access_token):
      '''Do a AMS PATCH request and return JSON.
      Args:
          endpoint (str): Azure Media Services Initial Endpoint.
          path (str): Azure Media Services Endpoint Path.
          body  (str): Azure Media Services Content Body.
          access_token (str): A valid Azure authentication token.
  
      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}
      response = requests.patch(endpoint, data=body, headers=headers, allow_redirects=False)
      # AMS response to the first call can be a redirect,
      # so we handle it here to make it transparent for the caller...
      if response.status_code == 301:
          redirected_url = ''.join([response.headers['location'], path])
          response = requests.patch(redirected_url, data=body, headers=headers)
      return response