def decode(data):
    """
    Decode a binary string into the original Python types.
    """
    buffer = StringIO(data)
    try:
        value = decoder[buffer.read(1)](buffer)
    except KeyError, e:
        raise DecodeError, "Type prefix not supported. (%s)" % e
    return value

    Decode a binary string into the original Python types.
    
recipes/Python/415503_safer_serializatisimple/recipe-415503.py