@classmethod
def deserialize(cls, packed, backend=None, body_mode=None, only_hdr=False):
    """Basically the opposite of serialize: make instance from data.

        :param packed:   The packed serialized representation produced by
                         the serialize method.

        :param backend:  The backend that you would like to use to be able
                         to store this instance. You can leave this as None
                         if you just want to use the item not store it again.

        :param body_mode=None:  Optional string mode as with serialize method.
                           If None, we first look at the body_mode in header
                           and if that is not use get_default_body_mode. You
                           can implement your own deserialize_body_<BODY_MODE>
                           method so you don't have to override this method.

        ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-

        :return:   Instance of this class matching the one which was
                   serialized into packed.

        ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-

        PURPOSE:   Inverse of serialize: produce an object from data.

                   Note: you generally do *NOT* want to override this but
                   instead override deserialize_body_* methods.

        """
    if only_hdr:
        return cls.packed_to_hdr(packed)
    hdr, body = cls.packed_to_hdr_and_body(packed)
    if body_mode is None:
        body_mode = hdr.get('body_mode', None)
    if body_mode is None:
        body_mode = cls.get_default_body_mode()
    myfunc = getattr(cls, 'deserialize_body_%s' % body_mode, None)
    if myfunc is None:
        raise ValueError('Invalid serialization body_mode %s' % body_mode)
    else:
        result = myfunc(hdr, body, backend)
        result.validate()
        return result
