code: def from_store_name(bucket_name, region=None):
      
      # Late-bind `region` for the sake of tests that inject the
      # AWS_REGION environment variable.
      if region is None:
          region = os.getenv('AWS_REGION')
  
      mostly_ok = _is_mostly_subdomain_compatible(bucket_name)
  
      if not mostly_ok:
          return CallingInfo(
              bucket_name=bucket_name,
              region=region,
              calling_format=connection.OrdinaryCallingFormat,
              ordinary_endpoint=must_resolve(region))
      else:
          if '.' in bucket_name:
              # The bucket_name might have been DNS compatible, but once
              # dots are involved TLS certificate validations will
              # certainly fail even if that's the case.
              return CallingInfo(
                  bucket_name=bucket_name,
                  calling_format=connection.OrdinaryCallingFormat,
                  region=region,
                  ordinary_endpoint=must_resolve(region))
          else:
              # If the bucket follows naming rules and has no dots in
              # the name, SubdomainCallingFormat can be used, with TLS,
              # world-wide.
              return CallingInfo(
                  bucket_name=bucket_name,
                  calling_format=connection.SubdomainCallingFormat,
                  region=region,
                  ordinary_endpoint=None)
  
      assert False
docs: Construct a CallingInfo value from a bucket name.
  
      This is useful to encapsulate the ugliness of setting up S3
      connections, especially with regions and TLS certificates are
      involved.