def fix_s3_host(request, signature_version, region_name, default_endpoint_url='s3.amazonaws.com', **kwargs):
 if ((signature_version is not botocore.UNSIGNED) and ('s3v4' in signature_version)):
  return
 elif (not _allowed_region(region_name)):
  return
 try:
  switch_to_virtual_host_style(request, signature_version, default_endpoint_url)
 except InvalidDNSNameError as e:
  bucket_name = e.kwargs['bucket_name']
  logger.debug('Not changing URI, bucket is not DNS compatible: %s', bucket_name)

def fix_s3_host ( request , signature_version , region_name , default_endpoint_url = 's3.amazonaws.com' , ** kwargs ) : if ( ( signature_version is not botocore . UNSIGNED ) and ( 's3v4' in signature_version ) ) : return elif ( not _allowed_region ( region_name ) ) : return try : switch_to_virtual_host_style ( request , signature_version , default_endpoint_url ) except InvalidDNSNameError as e : bucket_name = e . kwargs [ 'bucket_name' ] logger . debug ( 'Not changing URI, bucket is not DNS compatible: %s' , bucket_name )
this handler looks at s3 requests just before they are signed .