(value)
return mtoken, value
token = [CFWS] 1*ttext [CFWS]

    The RFC equivalent of ttext is any US-ASCII chars except space, ctls, or
    tspecials.  We also exclude tabs even though the RFC doesn't.

    The RFC implies the CFWS but is not explicit about it in the BNF.
token = [CFWS] 1*ttext [CFWS]
token = [ CFWS ] 1 * ttext [ CFWS ]
def get_token(value):
    """token = [CFWS] 1*ttext [CFWS]

    The RFC equivalent of ttext is any US-ASCII chars except space, ctls, or
    tspecials.  We also exclude tabs even though the RFC doesn't.

    The RFC implies the CFWS but is not explicit about it in the BNF.

    """
    mtoken = Token()
    if value and value[0] in CFWS_LEADER:
        token, value = get_cfws(value)
        mtoken.append(token)
    if value and value[0] in TOKEN_ENDS:
        raise errors.HeaderParseError(
            "expected token but found '{}'".format(value))
    token, value = get_ttext(value)
    mtoken.append(token)
    if value and value[0] in CFWS_LEADER:
        token, value = get_cfws(value)
        mtoken.append(token)
    return mtoken, value
def get_token ( value ) : mtoken = Token ( ) if value and value [ 0 ] in CFWS_LEADER : token , value = get_cfws ( value ) mtoken . append ( token ) if value and value [ 0 ] in TOKEN_ENDS : raise errors . HeaderParseError ( "expected token but found '{}'" . format ( value ) ) token , value = get_ttext ( value ) mtoken . append ( token ) if value and value [ 0 ] in CFWS_LEADER : token , value = get_cfws ( value ) mtoken . append ( token ) return mtoken , value