def decode_token(token):
    """
    Top-level method to decode a JWT.
    Takes either a compact-encoded JWT with a single signature,
    or a multi-sig JWT in the JSON-serialized format.

    Returns the deserialized token, as a dict.
    The signatures will still be base64-encoded
    """
    if isinstance(token, (unicode,str)):
        return _decode_token_compact(token)

    else:
        return _decode_token_json(token)