code: def _check_S3ResponseError(e):
      """Returns True if should be retried.
  
      raises ... if token has expired"""
      # https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList
      if e.status in (
          307,  # MovedTemporarily -- DNS updates etc
          503,  # Slow down -- too many requests, so perfect fit to sleep a bit
      ):
          return True
      if e.status == 400:
          # Generic Bad Request -- could be many things! generally -- we retry, but
          # some times provide more directed reaction
          # ATM, as used, many requests we send with boto might be just HEAD requests
          # (if I got it right) and we would not receive BODY back with the detailed
          # error_code.  Then we will allow to retry until we get something we know how to
          # handle it more specifically
          if e.error_code == "ExpiredToken":
              raise AccessPermissionExpiredError(
                  "Used token to access S3 has expired"
              ) from e
          elif not e.error_code:
              lgr.log(5, "Empty error_code in %s", e)
          return True
      return False
  
imports: import mimetypes
  from os.path import splitext
  import re
  from datalad.support.network import urlquote, URL
  import logging
  import datalad.log
  from datalad.support.exceptions import CapturedException, DownloadError, AccessDeniedError, AccessPermissionExpiredError, AnonymousAccessDeniedError
  from datalad.utils import try_multiple_dec
  from urllib.request import urlopen, Request
label_desc: Use image node_id 3 for calling a global function with example usage: _check_S3ResponseError(e) and returns: False, True, True