def is_valid_bucket_name(bucket_name):
 regex = re.compile('[a-z0-9][a-z0-9\\._-]{2,254}$')
 if (not regex.match(bucket_name)):
  return False
 if iptools.ipv4.validate_ip(bucket_name):
  return False
 return True

def is_valid_bucket_name ( bucket_name ) : regex = re . compile ( '[a-z0-9][a-z0-9\\._-]{2,254}$' ) if ( not regex . match ( bucket_name ) ) : return False if iptools . ipv4 . validate_ip ( bucket_name ) : return False return True
check if bucket_name is a valid s3 bucket name : 1 .