code: def task(data, endpoint, samples, time_based):
      timeout = 60
  
      if isinstance(data, str):
          headers = {"content-type": "application/json"}
      elif isinstance(data, bytes):
          headers = {"content-type": "application/octet-stream"}
      else:
          return
  
      if time_based == 0.0:
          for i in range(samples):
              try:
                  resp = requests.post(
                      endpoint,
                      data=data,
                      headers=headers,
                      timeout=timeout,
                  )
              except Exception as e:
                  print(e)
                  break
              time.sleep(0.1)
          return [samples]
      else:
          start = time.time()
          counter = 0
          while start + time_based >= time.time():
              try:
                  resp = requests.post(
                      endpoint,
                      data=data,
                      headers=headers,
                      timeout=timeout,
                  )
              except Exception as e:
                  print(e)
                  break
              time.sleep(0.1)
              counter += 1
          return [counter]
  
file_path: cortex/test/utils/throughput_test.py
imports: import os
  import sys
  import click
  import concurrent.futures
  import requests
  import imageio
  import json
  import time
  import itertools
  import cv2
  import numpy
  from validator_collection import checkers
label_desc: Use image node_id 4 for calling a global function with example usage: task(data, endpoint, samples, time_based) and returns: list, list