import six
import pickle


def any_binary(data):
    """
    Parse any known binary messages, detect where
    they belong to and validate them.

    :param data: binary data
    :return: Serialisable
    """
    if not isinstance(data, six.text_type):
        data = pickle.loads(data)

    return data