def _deserialize_encrypted_data_keys(stream):
    # type: (IO) -> Set[EncryptedDataKey]
    """Deserialize some encrypted data keys from a stream.

    :param stream: Stream from which to read encrypted data keys
    :return: Loaded encrypted data keys
    :rtype: set of :class:`EncryptedDataKey`
    """
    (encrypted_data_key_count,) = unpack_values(">H", stream)
    encrypted_data_keys = set([])
    for _ in range(encrypted_data_key_count):
        (key_provider_length,) = unpack_values(">H", stream)
        (key_provider_identifier,) = unpack_values(">{}s".format(key_provider_length), stream)
        (key_provider_information_length,) = unpack_values(">H", stream)
        (key_provider_information,) = unpack_values(">{}s".format(key_provider_information_length), stream)
        (encrypted_data_key_length,) = unpack_values(">H", stream)
        encrypted_data_key = stream.read(encrypted_data_key_length)
        encrypted_data_keys.add(
            EncryptedDataKey(
                key_provider=MasterKeyInfo(
                    provider_id=to_str(key_provider_identifier), key_info=key_provider_information
                ),
                encrypted_data_key=encrypted_data_key,
            )
        )
    return encrypted_data_keys
def _deserialize_encrypted_data_keys ( stream ) : ( encrypted_data_key_count , ) = unpack_values ( ">H" , stream ) encrypted_data_keys = set ( [ ] ) for _ in range ( encrypted_data_key_count ) : ( key_provider_length , ) = unpack_values ( ">H" , stream ) ( key_provider_identifier , ) = unpack_values ( ">{}s" . format ( key_provider_length ) , stream ) ( key_provider_information_length , ) = unpack_values ( ">H" , stream ) ( key_provider_information , ) = unpack_values ( ">{}s" . format ( key_provider_information_length ) , stream ) ( encrypted_data_key_length , ) = unpack_values ( ">H" , stream ) encrypted_data_key = stream . read ( encrypted_data_key_length ) encrypted_data_keys . add ( EncryptedDataKey ( key_provider = MasterKeyInfo ( provider_id = to_str ( key_provider_identifier ) , key_info = key_provider_information ) , encrypted_data_key = encrypted_data_key , ) ) return encrypted_data_keys
Deserialize some encrypted data keys from a stream.

    :param stream: Stream from which to read encrypted data keys
    :return: Loaded encrypted data keys
    :rtype: set of :class:`EncryptedDataKey`