code: def poll(
      relative_url: str,
      error_field: Optional[str] = None,
      expected_code: Optional[int] = 200,
      headers: Optional[Headers] = None,
      url: str = URL,
  ) -> Response:
      interval = INTERVAL
      timeout = MAX_DURATION
      retries = timeout // interval
      should_retry = True
      response = None
      while retries > 0 and should_retry:
          retries -= 1
          time.sleep(interval)
          response = get(
              relative_url=relative_url, headers=headers, url=url
          )
          if error_field is not None:
              # currently, when the dataset is being processed, the error message contains "Retry later"
              try:
                  should_retry = (
                      "retry later"
                      in response.json()[error_field].lower()
                  )
              except Exception:
                  should_retry = False
          else:
              # just retry if the response is not the expected code
              should_retry = response.status_code != expected_code
      if response is None:
          raise RuntimeError("no request has been done")
      return response
  
imports: import json
  import os
  import re
  import time
  from collections.abc import Iterator, Mapping
  from contextlib import contextmanager, suppress
  from pathlib import Path
  from typing import Any, Optional
  import requests
  from huggingface_hub.hf_api import HfApi
  from huggingface_hub.utils._errors import hf_raise_for_status
  from requests import Response
  from .constants import CI_HUB_ENDPOINT
label_desc: Use image node_id 3 for calling a global function with example usage: poll(relative_url, error_field, expected_code, headers, url) and returns: response