code: def serialize_encrypted_data_key(encrypted_data_key):
      
      encrypted_data_key_format = (
          ">"  # big endian
          "H"  # key provider ID length
          "{provider_id_len}s"  # key provider ID
          "H"  # key info length
          "{provider_info_len}s"  # key info
          "H"  # encrypted data key length
          "{enc_data_key_len}s"  # encrypted data key
      )
      return struct.pack(
          encrypted_data_key_format.format(
              provider_id_len=len(encrypted_data_key.key_provider.provider_id),
              provider_info_len=len(encrypted_data_key.key_provider.key_info),
              enc_data_key_len=len(encrypted_data_key.encrypted_data_key),
          ),
          len(encrypted_data_key.key_provider.provider_id),
          to_bytes(encrypted_data_key.key_provider.provider_id),
          len(encrypted_data_key.key_provider.key_info),
          to_bytes(encrypted_data_key.key_provider.key_info),
          len(encrypted_data_key.encrypted_data_key),
          encrypted_data_key.encrypted_data_key,
      )
docs: Serializes an encrypted data key.
  
      .. versionadded:: 1.3.0
  
      :param encrypted_data_key: Encrypted data key to serialize
      :type encrypted_data_key: aws_encryption_sdk.structures.EncryptedDataKey
      :returns: Serialized encrypted data key
      :rtype: bytes