def unserialize_data(data, compression=False, encryption=False):
    """Unserializes the packet data and converts it from json format to normal
    Python datatypes.

    If you choose to enable encryption and/or compression when serializing
    data, you MUST enable the same options when unserializing data.

    Args:
      data (str): The raw, serialized packet data delivered from the transport
        protocol.
      compression (boolean): True or False value on whether or not to
        uncompress the serialized data.
      encryption (rsa.encryption): An encryption instance used to decrypt the
        message if encryption is desired.

    Returns:
      The message unserialized in normal Python datatypes.

    """
    try:
        if encryption:
            data = encryption.decrypt(data)

    except Exception as err:
        logger.error("Decryption Error: " + str(err))
        message = False
    try:
        if compression:
            data = binascii.a2b_base64(data)
            data = zlib.decompress(data)
            message = json.loads(data)

    except Exception as err:
        logger.error("Decompression Error: " + str(err))
        message = False

    decoded_message = data.decode()

    if not encryption and not compression:
        message = json.loads(decoded_message)

    return message