code: def makeHttpRequest(method, url, payload, headers, retries=MAX_RETRIES, session=None):
      
      retry = -1
      response = None
      while retry < retries:
          retry += 1
          # if this isn't the first retry then we sleep
          if retry > 0:
              snooze = float(retry * retry) / 10.0
              log.info('Sleeping %0.2f seconds for exponential backoff', snooze)
              time.sleep(snooze)
  
          # Seek payload to start, if it is a file
          if hasattr(payload, 'seek'):
              payload.seek(0)
  
          log.debug('Making attempt %d', retry)
          try:
              response = makeSingleHttpRequest(method, url, payload, headers, session)
          except requests.exceptions.RequestException as rerr:
              if retry < retries:
                  log.warn('Retrying because of: %s' % rerr)
                  continue
              # raise a connection exception
              raise rerr
          # Handle non 2xx status code and retry if possible
          try:
              response.raise_for_status()
          except requests.exceptions.RequestException:
              pass
          status = response.status_code
          if 500 <= status and status < 600 and retry < retries:
              if retry < retries:
                  log.warn('Retrying because of: %d status' % status)
                  continue
              else:
                  raise exceptions.TaskclusterRestFailure("Unknown Server Error", superExc=None)
          return response
  
      # This code-path should be unreachable
      assert False, "Error from last retry should have been raised!"
docs: Make an HTTP request and retry it until success, return request