code: def is_valid_bucket_name(bucket_name):
      
      # Verify bucket name length.
      if len(bucket_name) < 3:
          raise InvalidBucketError('Bucket name cannot be less than'
                                   ' 3 characters.')
      if len(bucket_name) > 63:
          raise InvalidBucketError('Bucket name cannot be more than'
                                   ' 63 characters.')
      if '..' in bucket_name:
          raise InvalidBucketError('Bucket name cannot have successive'
                                   ' periods.')
  
      match = _VALID_BUCKETNAME_REGEX.match(bucket_name)
      if match is None or match.end() != len(bucket_name):
          raise InvalidBucketError('Bucket name does not follow S3 standards.'
                                   ' Bucket: {0}'.format(bucket_name))
  
      return True
docs: Check to see if the ``bucket_name`` complies with the
      restricted DNS naming conventions necessary to allow
      access via virtual-hosting style.
  
      :param bucket_name: Bucket name in *str*.
      :return: True if the bucket is valid. Raise :exc:`InvalidBucketError`
         otherwise.