def factory(token, alg=''):
    """
    Instantiate an JWS instance if the token is a signed JWT.

    :param token: The token that might be a signed JWT
    :param alg: The expected signature algorithm
    :return: A JWS instance if the token was a signed JWT, otherwise None
    """

    _jw = JWS(alg=alg)
    if _jw.is_jws(token):
        return _jw
    else:
        return None
def factory ( token , alg = '' ) : _jw = JWS ( alg = alg ) if _jw . is_jws ( token ) : return _jw else : return None
Instantiate an JWS instance if the token is a signed JWT.

    :param token: The token that might be a signed JWT
    :param alg: The expected signature algorithm
    :return: A JWS instance if the token was a signed JWT, otherwise None