(value)
return address, value
address = mailbox / group

    Note that counter-intuitively, an address can be either a single address or
    a list of addresses (a group).  This is why the returned Address object has
    a 'mailboxes' attribute which treats a single address as a list of length
    one.  When you need to differentiate between to two cases, extract the single
    element, which is either a mailbox or a group token.
address = mailbox / group
address = mailbox / group
def get_address(value):
    """ address = mailbox / group

    Note that counter-intuitively, an address can be either a single address or
    a list of addresses (a group).  This is why the returned Address object has
    a 'mailboxes' attribute which treats a single address as a list of length
    one.  When you need to differentiate between to two cases, extract the single
    element, which is either a mailbox or a group token.

    """
    # The formal grammar isn't very helpful when parsing an address.  mailbox
    # and group, especially when allowing for obsolete forms, start off very
    # similarly.  It is only when you reach one of @, <, or : that you know
    # what you've got.  So, we try each one in turn, starting with the more
    # likely of the two.  We could perhaps make this more efficient by looking
    # for a phrase and then branching based on the next character, but that
    # would be a premature optimization.
    address = Address()
    try:
        token, value = get_group(value)
    except errors.HeaderParseError:
        try:
            token, value = get_mailbox(value)
        except errors.HeaderParseError:
            raise errors.HeaderParseError(
                "expected address but found '{}'".format(value))
    address.append(token)
    return address, value
def get_address ( value ) : # The formal grammar isn't very helpful when parsing an address.  mailbox # and group, especially when allowing for obsolete forms, start off very # similarly.  It is only when you reach one of @, <, or : that you know # what you've got.  So, we try each one in turn, starting with the more # likely of the two.  We could perhaps make this more efficient by looking # for a phrase and then branching based on the next character, but that # would be a premature optimization. address = Address ( ) try : token , value = get_group ( value ) except errors . HeaderParseError : try : token , value = get_mailbox ( value ) except errors . HeaderParseError : raise errors . HeaderParseError ( "expected address but found '{}'" . format ( value ) ) address . append ( token ) return address , value