code: def _handle_exception(e, bucket_name):
      """Helper to handle S3 connection exception"""
      raise (
          AccessDeniedError
          if e.error_code == "AccessDenied"
          else DownloadError
      )("Cannot connect to %s S3 bucket." % (bucket_name)) from e
  
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 2 for calling a global function with example usage: _handle_exception(e, bucket_name) without return types