docstr: Get the credentials for an AWS S3 bucket from the config
  :param uri: URI of bucket, directory or file
  :return: S3BucketConfig: bucket config
docstr_tok: ["Get","the","credentials","for","an","AWS","S3","bucket","from","the","config",":","param","uri",":","URI","of","bucket",",","directory","or","file",":","return",":","S3BucketConfig",":","bucket","config"]
code: def get_config_by_uri(self, uri):
      """
      Get the credentials for an AWS S3 bucket from the config
      :param uri: URI of bucket, directory or file
      :return: S3BucketConfig: bucket config
      """
  
      def find_match(uri):
          self._update_prefixes(refresh=False)
          uri = uri.lower()
          res = (
              config
              for config, prefix in self._prefixes
              if prefix is not None and uri.startswith(prefix)
          )
  
          try:
              return next(res)
          except StopIteration:
              return None
  
      match = find_match(uri)
  
      if match:
          return match
  
      parsed = furl.furl(uri)
  
      if parsed.port:
          host = parsed.netloc
          parts = parsed.path.segments
          bucket = parts[0] if parts else None
      else:
          host = None
          bucket = parsed.netloc
  
      return S3BucketConfig(
          key=self._default_key,
          secret=self._default_secret,
          region=self._default_region,
          multipart=True,
          use_credentials_chain=self._default_use_credentials_chain,
          bucket=bucket,
          host=host,
          token=self._default_token,
          extra_args=self._default_extra_args,
      )
  
imports: import abc
  import warnings
  from copy import copy
  from operator import itemgetter
  from os import getenv
  import furl
  import six
  from attr import attrib, attrs
label_desc: Use image node_id 8 for calling the S3BucketConfigurations obj's underlying member method code with example usage: obj.get_config_by_uri(uri) and returns: S3BucketConfig, match, next, None