def ScheduleApiQuery(api_query, randomize=False, countdown=None):
  if (not api_query.in_queue
      and (api_query.is_scheduled and not api_query.is_abandoned
           and not api_query.is_error_limit_reached)):

    random_seconds = 0
    if randomize:
      random_seconds = random.randint(0, co.MAX_RANDOM_COUNTDOWN)

    if countdown is None:
      countdown = api_query.refresh_interval

    try:
      taskqueue.add(
          url=co.LINKS['admin_runtask'],
          countdown=countdown + random_seconds,
          params={
              'query_id': api_query.key(),
          })
      api_query.in_queue = True
      api_query.put()
    except taskqueue.Error as e:
      logging.error(
          'Error adding task to queue. API Query ID: {}. Error: {}'.format(
              api_query.key(), e))
Create VM dependencies.
dataset/ETHPy150Open googleanalytics/google-analytics-super-proxy/src/controllers/util/schedule_helper.py/ScheduleApiQuery--crossover with--dataset/ETHPy150Open GoogleCloudPlatform/PerfKitBenchmarker/perfkitbenchmarker/providers/azure/azure_virtual_machine.py/AzureVirtualMachine._CreateDependencies