code: def ad_address(mode, hit_id):
      
      if mode == "debug":
          address = '/complete'
      elif mode in ["sandbox", "live"]:
          username = os.getenv('psiturk_access_key_id',
                               config.get("psiTurk Access",
                                          "psiturk_access_key_id"))
          password = os.getenv('psiturk_secret_access_id',
                               config.get("psiTurk Access",
                                          "psiturk_secret_access_id"))
          try:
              req = requests.get(
                  'https://api.psiturk.org/api/ad/lookup/' + hit_id,
                  auth=(username, password))
          except:
              raise ValueError('api_server_not_reachable')
          else:
              if req.status_code == 200:
                  hit_address = req.json()['ad_id']
              else:
                  raise ValueError("something here")
          if mode == "sandbox":
              address = ('https://sandbox.ad.psiturk.org/complete/' +
                         str(hit_address))
          elif mode == "live":
              address = 'https://ad.psiturk.org/complete/' + str(hit_address)
      else:
          raise ValueError("Unknown mode: {}".format(mode))
      return success_response(field="address",
                              data=address,
                              request_type="ad_address")
docs: Get the address of the ad on AWS.
  
      This is used at the end of the experiment to send participants
      back to AWS where they can complete and submit the HIT.