(value)
return attribute, value
[CFWS] 1*attrtext [CFWS]

    This version of the BNF makes the CFWS explicit, and as usual we use a
    value terminal for the actual run of characters.  The RFC equivalent of
    attrtext is the token characters, with the subtraction of '*', "'", and '%'.
    We include tab in the excluded set just as we do for token.
[CFWS] 1*attrtext [CFWS]
[ CFWS ] 1 * attrtext [ CFWS ]
def get_attribute(value):
    """ [CFWS] 1*attrtext [CFWS]

    This version of the BNF makes the CFWS explicit, and as usual we use a
    value terminal for the actual run of characters.  The RFC equivalent of
    attrtext is the token characters, with the subtraction of '*', "'", and '%'.
    We include tab in the excluded set just as we do for token.

    """
    attribute = Attribute()
    if value and value[0] in CFWS_LEADER:
        token, value = get_cfws(value)
        attribute.append(token)
    if value and value[0] in ATTRIBUTE_ENDS:
        raise errors.HeaderParseError(
            "expected token but found '{}'".format(value))
    token, value = get_attrtext(value)
    attribute.append(token)
    if value and value[0] in CFWS_LEADER:
        token, value = get_cfws(value)
        attribute.append(token)
    return attribute, value
def get_attribute ( value ) : attribute = Attribute ( ) if value and value [ 0 ] in CFWS_LEADER : token , value = get_cfws ( value ) attribute . append ( token ) if value and value [ 0 ] in ATTRIBUTE_ENDS : raise errors . HeaderParseError ( "expected token but found '{}'" . format ( value ) ) token , value = get_attrtext ( value ) attribute . append ( token ) if value and value [ 0 ] in CFWS_LEADER : token , value = get_cfws ( value ) attribute . append ( token ) return attribute , value