(value)
return angle_addr, value
angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr
        obs-angle-addr = [CFWS] "<" obs-route addr-spec ">" [CFWS]
angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr
        obs-angle-addr = [CFWS] "<" obs-route addr-spec ">" [CFWS]
angle - addr = [ CFWS ] < addr - spec > [ CFWS ] / obs - angle - addr obs - angle - addr = [ CFWS ] < obs - route addr - spec > [ CFWS ]
def get_angle_addr(value):
    """ angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr
        obs-angle-addr = [CFWS] "<" obs-route addr-spec ">" [CFWS]

    """
    angle_addr = AngleAddr()
    if value[0] in CFWS_LEADER:
        token, value = get_cfws(value)
        angle_addr.append(token)
    if not value or value[0] != '<':
        raise errors.HeaderParseError(
            "expected angle-addr but found '{}'".format(value))
    angle_addr.append(ValueTerminal('<', 'angle-addr-start'))
    value = value[1:]
    # Although it is not legal per RFC5322, SMTP uses '<>' in certain
    # circumstances.
    if value[0] == '>':
        angle_addr.append(ValueTerminal('>', 'angle-addr-end'))
        angle_addr.defects.append(errors.InvalidHeaderDefect(
            "null addr-spec in angle-addr"))
        value = value[1:]
        return angle_addr, value
    try:
        token, value = get_addr_spec(value)
    except errors.HeaderParseError:
        try:
            token, value = get_obs_route(value)
            angle_addr.defects.append(errors.ObsoleteHeaderDefect(
                "obsolete route specification in angle-addr"))
        except errors.HeaderParseError:
            raise errors.HeaderParseError(
                "expected addr-spec or obs-route but found '{}'".format(value))
        angle_addr.append(token)
        token, value = get_addr_spec(value)
    angle_addr.append(token)
    if value and value[0] == '>':
        value = value[1:]
    else:
        angle_addr.defects.append(errors.InvalidHeaderDefect(
            "missing trailing '>' on angle-addr"))
    angle_addr.append(ValueTerminal('>', 'angle-addr-end'))
    if value and value[0] in CFWS_LEADER:
        token, value = get_cfws(value)
        angle_addr.append(token)
    return angle_addr, value
def get_angle_addr ( value ) : angle_addr = AngleAddr ( ) if value [ 0 ] in CFWS_LEADER : token , value = get_cfws ( value ) angle_addr . append ( token ) if not value or value [ 0 ] != '<' : raise errors . HeaderParseError ( "expected angle-addr but found '{}'" . format ( value ) ) angle_addr . append ( ValueTerminal ( '<' , 'angle-addr-start' ) ) value = value [ 1 : ] # Although it is not legal per RFC5322, SMTP uses '<>' in certain # circumstances. if value [ 0 ] == '>' : angle_addr . append ( ValueTerminal ( '>' , 'angle-addr-end' ) ) angle_addr . defects . append ( errors . InvalidHeaderDefect ( "null addr-spec in angle-addr" ) ) value = value [ 1 : ] return angle_addr , value try : token , value = get_addr_spec ( value ) except errors . HeaderParseError : try : token , value = get_obs_route ( value ) angle_addr . defects . append ( errors . ObsoleteHeaderDefect ( "obsolete route specification in angle-addr" ) ) except errors . HeaderParseError : raise errors . HeaderParseError ( "expected addr-spec or obs-route but found '{}'" . format ( value ) ) angle_addr . append ( token ) token , value = get_addr_spec ( value ) angle_addr . append ( token ) if value and value [ 0 ] == '>' : value = value [ 1 : ] else : angle_addr . defects . append ( errors . InvalidHeaderDefect ( "missing trailing '>' on angle-addr" ) ) angle_addr . append ( ValueTerminal ( '>' , 'angle-addr-end' ) ) if value and value [ 0 ] in CFWS_LEADER : token , value = get_cfws ( value ) angle_addr . append ( token ) return angle_addr , value