code: def limit_requests_per_time(min_secs_between_requests=2.0):
      last_requests = {}
  
      def outer_wrapper(fn):
          def inner_wrapper(request, *args, **kwargs):
              url = (
                  request.full_url
                  if isinstance(request, Request)
                  else request
              )
  
              netloc = urlparse(url).netloc
              last_request = last_requests.get(netloc)
              if last_request is not None:
                  elapsed_secs = (
                      datetime.now() - last_request
                  ).total_seconds()
                  delta = min_secs_between_requests - elapsed_secs
                  if delta > 0:
                      time.sleep(delta)
  
              response = fn(request, *args, **kwargs)
              last_requests[netloc] = datetime.now()
  
              return response
  
          return inner_wrapper
  
      return outer_wrapper
  
imports: import contextlib
  import itertools
  import tempfile
  import time
  import traceback
  import unittest.mock
  import warnings
  from datetime import datetime
  from distutils import dir_util
  from os import path
  from urllib.error import HTTPError, URLError
  from urllib.parse import urlparse
  from urllib.request import Request, urlopen
  import pytest
  from torchvision import datasets
  from torchvision.datasets.utils import _get_redirect_url, USER_AGENT
label_desc: Use image node_id 1 for calling a global function with example usage: limit_requests_per_time(min_secs_between_requests) and returns: outer_wrapper, inner_wrapper, response