code: def _create_retry_decorator():
      import openai.error
      import tenacity
  
      min_seconds = 4
      max_seconds = 10
      max_attempts = 5
      # Wait 2^x * 1 second between each retry starting with
      # 4 seconds, then up to 10 seconds, then 10 seconds afterwards
      return tenacity.retry(
          reraise=True,
          stop=tenacity.stop_after_attempt(max_attempts),
          wait=tenacity.wait_exponential(
              multiplier=1, min=min_seconds, max=max_seconds
          ),
          retry=(
              tenacity.retry_if_exception_type(openai.error.Timeout)
              | tenacity.retry_if_exception_type(openai.error.APIError)
              | tenacity.retry_if_exception_type(
                  openai.error.APIConnectionError
              )
              | tenacity.retry_if_exception_type(
                  openai.error.RateLimitError
              )
              | tenacity.retry_if_exception_type(
                  openai.error.ServiceUnavailableError
              )
          ),
          before_sleep=tenacity.before_sleep_log(
              _logger, logging.WARNING
          ),
      )
  
imports: import logging
  from contextlib import contextmanager
label_desc: Use image node_id 1 for calling a global function with example usage: _create_retry_decorator() and returns: tenacity