code: def to_bytes(data):
      
      if isinstance(data, six.string_types) and not isinstance(data, bytes):
          return codecs.encode(data, aws_encryption_sdk.internal.defaults.ENCODING)
      return data
docs: Takes an input str or bytes object and returns an equivalent bytes object.
  
      :param data: Input data
      :type data: str or bytes
      :returns: Data normalized to bytes
      :rtype: bytes