#NEWLINE# def validate_bucket_name( name ) : #NEWLINE# #INDENT# "Make sure the bucket name conforms to Amazon's expectations as described at:\n    http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html#bucketnamingrules\n    The laxer rules for US East (N. Virginia) are not supported.\n    " #NEWLINE# label = '[a-z0-9]+(?:[a-z0-9\\-]*[a-z0-9])?' #NEWLINE# validate_name = re . compile ( ( ( ( ( '^' + label ) + '(?:\\.' ) + label ) + ')*$' ) ) #NEWLINE# is_ip_address = re . compile ( '^[0-9]+(?:\\.[0-9]+){3}$' ) #NEWLINE# return ( ( len ( name ) >= 3 ) and ( len ( name ) <= 63 ) and bool ( validate_name . match ( name ) ) and ( not bool ( is_ip_address . match ( name ) ) ) )