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

    This is like the non-extended version except we allow % characters, so that
    we can pick up an encoded value as a single string.
[CFWS] 1*extended_attrtext [CFWS]
[ CFWS ] 1 * extended_attrtext [ CFWS ]
def get_extended_attribute(value):
    """ [CFWS] 1*extended_attrtext [CFWS]

    This is like the non-extended version except we allow % characters, so that
    we can pick up an encoded value as a single string.

    """
    # XXX: should we have an ExtendedAttribute TokenList?
    attribute = Attribute()
    if value and value[0] in CFWS_LEADER:
        token, value = get_cfws(value)
        attribute.append(token)
    if value and value[0] in EXTENDED_ATTRIBUTE_ENDS:
        raise errors.HeaderParseError(
            "expected token but found '{}'".format(value))
    token, value = get_extended_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_extended_attribute ( value ) : # XXX: should we have an ExtendedAttribute TokenList? attribute = Attribute ( ) if value and value [ 0 ] in CFWS_LEADER : token , value = get_cfws ( value ) attribute . append ( token ) if value and value [ 0 ] in EXTENDED_ATTRIBUTE_ENDS : raise errors . HeaderParseError ( "expected token but found '{}'" . format ( value ) ) token , value = get_extended_attrtext ( value ) attribute . append ( token ) if value and value [ 0 ] in CFWS_LEADER : token , value = get_cfws ( value ) attribute . append ( token ) return attribute , value