def get_bucket_location_or_error(access_key, secret_key, bucket_name):
 try:
  connection = connect_s3(access_key, secret_key)
 except:
  raise InvalidAuthError()
 if ((bucket_name != bucket_name.lower()) or ('.' in bucket_name)):
  connection.calling_format = OrdinaryCallingFormat()
 try:
  return connect_s3(access_key, secret_key).get_bucket(bucket_name, validate=False).get_location()
 except exception.S3ResponseError:
  raise InvalidFolderError()

def get_bucket_location_or_error ( access_key , secret_key , bucket_name ) : try : connection = connect_s3 ( access_key , secret_key ) except : raise InvalidAuthError ( ) if ( ( bucket_name != bucket_name . lower ( ) ) or ( '.' in bucket_name ) ) : connection . calling_format = OrdinaryCallingFormat ( ) try : return connect_s3 ( access_key , secret_key ) . get_bucket ( bucket_name , validate = False ) . get_location ( ) except exception . S3ResponseError : raise InvalidFolderError ( )
returns the location of a bucket or raises addonerror .