class_docstr: Authenticator for S3 AWS
      
class_docstr_tok: ["Authenticator","for","S3","AWS"]
docstr: Authenticates to the specified bucket using provided credentials
  
  Returns
  -------
  bucket
docstr_tok: ["Authenticates","to","the","specified","bucket","using","provided","credentials","Returns","--","--","--","-","bucket"]
code: def authenticate(self, bucket_name, credential, cache=True):
      """Authenticates to the specified bucket using provided credentials
  
      Returns
      -------
      bucket
      """
  
      if not boto:
          raise RuntimeError(
              "%s requires boto module which is N/A" % self
          )
  
      # Shut up boto if we do not care to listen ;)
      boto_lgr.setLevel(
          logging.CRITICAL
          if lgr.getEffectiveLevel() > 1
          else logging.DEBUG
      )
  
      # credential might contain 'session' token as well
      # which could be provided   as   security_token=<token>.,
      # see http://stackoverflow.com/questions/7673840/is-there-a-way-to-create-a-s3-connection-with-a-sessions-token
      conn_kwargs = self._conn_kwargs.copy()
      if bucket_name.lower() != bucket_name:
          # per http://stackoverflow.com/a/19089045/1265472
          conn_kwargs["calling_format"] = OrdinaryCallingFormat()
  
      if credential is not None:
          credentials = credential()
          conn_kind = "with authentication"
          conn_args = [credentials["key_id"], credentials["secret_id"]]
          conn_kwargs["security_token"] = credentials.get("session")
      else:
          conn_kind = "anonymously"
          conn_args = []
          conn_kwargs["anon"] = True
      if "." in bucket_name:
          conn_kwargs["calling_format"] = OrdinaryCallingFormat()
  
      lgr.info(
          "S3 session: Connecting to the bucket %s %s",
          bucket_name,
          conn_kind,
      )
      self.connection = conn = boto.connect_s3(
          *conn_args, **conn_kwargs
      )
      self.bucket = bucket = get_bucket(conn, bucket_name)
      return bucket
  
imports: import re
  from urllib.parse import urlsplit, unquote
  from ..utils import auto_repr, ensure_dict_from_str
  from ..dochelpers import borrowkwargs
  from ..support.network import get_url_straight_filename, iso8601_to_epoch, rfc2822_to_epoch
  from .base import Authenticator
  from .base import BaseDownloader, DownloaderSession
  from ..support.exceptions import AccessPermissionExpiredError, CapturedException, TargetFileAbsent
  from ..support.s3 import Key, OrdinaryCallingFormat, S3ResponseError, boto, get_bucket, try_multiple_dec_s3
  from ..support.status import FileStatus
  import logging
  from logging import getLogger
label_desc: Use image node_id 2 for calling the S3Authenticator obj's underlying member method code with example usage: obj.authenticate(bucket_name, credential, cache) and returns: bucket