def validate_bucket_name(name):
 if (('_' in name) or (len(name) < 3) or (len(name) > 63) or (not name[(-1)].isalnum())):
  return False
 elif (('.-' in name) or ('-.' in name) or ('..' in name) or (not name[0].isalnum())):
  return False
 elif re.match('^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$', name):
  return False
 else:
  return True

def validate_bucket_name ( name ) : if ( ( '_' in name ) or ( len ( name ) < 3 ) or ( len ( name ) > 63 ) or ( not name [ ( - 1 ) ] . isalnum ( ) ) ) : return False elif ( ( '.-' in name ) or ( '-.' in name ) or ( '..' in name ) or ( not name [ 0 ] . isalnum ( ) ) ) : return False elif re . match ( '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$' , name ) : return False else : return True
make sure the bucket name conforms to amazons expectations as described at: URL#bucketnamingrules the laxer rules for us east are not supported .