code: async def makeHttpRequest(method, url, payload, headers, retries=utils.MAX_RETRIES, session=None):
      
      retry = -1
      response = None
      implicit = False
      if session is None:
          implicit = True
          session = aiohttp.ClientSession()
  
      def cleanup():
          if implicit:
              loop = asyncio.get_event_loop()
              loop.run_until_complete(session.close())
  
      try:
          while True:
              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)
                  await asyncio.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:
                  with async_timeout.timeout(60):
                      response = await makeSingleHttpRequest(method, url, payload, headers, session)
              except aiohttp.ClientError as rerr:
                  if retry < retries:
                      log.warn('Retrying because of: %s' % rerr)
                      continue
                  # raise a connection exception
                  raise rerr
              except ValueError as rerr:
                  log.warn('ValueError from aiohttp: redirect to non-http or https')
                  raise rerr
              except RuntimeError as rerr:
                  log.warn('RuntimeError from aiohttp: session closed')
                  raise rerr
              # Handle non 2xx status code and retry if possible
              status = response.status
              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
      finally:
          cleanup()
      # 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