code: def get_ams_access_token(accountname, accountkey):
      '''Get Media Services Authentication Token.
  
      Args:
          accountname (str): Azure Media Services account name.
          accountkey (str): Azure Media Services Key.
  
      Returns:
          HTTP response. JSON body.
      '''
      accountkey_encoded = urllib.parse.quote(accountkey, safe='')
      body = "grant_type=client_credentials&client_id=" + accountname + \
  	"&client_secret=" + accountkey_encoded + " &scope=urn%3aWindowsAzureMediaServices"
      return do_ams_auth(ams_auth_endpoint, bodyf get_ams_access_token(accountname, accountkey):
      '''Get Media Services Authentication Token.
  
      Args:
          accountname (str): Azure Media Services account name.
          accountkey (str): Azure Media Services Key.
  
      Returns:
          HTTP response. JSON body.
      '''
      accountkey_encoded = urllib.parse.quote(accountkey, safe='')
      body = "grant_type=client_credentials&client_id=" + accountname + \
  	"&client_secret=" + accountkey_encoded + " &scope=urn%3aWindowsAzureMediaServices"
      return do_ams_auth(ams_auth_endpoint, body)
docs: Get Media Services Authentication Token.
  
      Args:
          accountname (str): Azure Media Services account name.
          accountkey (str): Azure Media Services Key.
  
      Returns:
          HTTP response. JSON body.