(value)
return mailbox, value
mailbox = name-addr / addr-spec
mailbox = name-addr / addr-spec
mailbox = name - addr / addr - spec
def get_mailbox(value):
    """ mailbox = name-addr / addr-spec

    """
    # The only way to figure out if we are dealing with a name-addr or an
    # addr-spec is to try parsing each one.
    mailbox = Mailbox()
    try:
        token, value = get_name_addr(value)
    except errors.HeaderParseError:
        try:
            token, value = get_addr_spec(value)
        except errors.HeaderParseError:
            raise errors.HeaderParseError(
                "expected mailbox but found '{}'".format(value))
    if any(isinstance(x, errors.InvalidHeaderDefect)
                       for x in token.all_defects):
        mailbox.token_type = 'invalid-mailbox'
    mailbox.append(token)
    return mailbox, value
def get_mailbox ( value ) : # The only way to figure out if we are dealing with a name-addr or an # addr-spec is to try parsing each one. mailbox = Mailbox ( ) try : token , value = get_name_addr ( value ) except errors . HeaderParseError : try : token , value = get_addr_spec ( value ) except errors . HeaderParseError : raise errors . HeaderParseError ( "expected mailbox but found '{}'" . format ( value ) ) if any ( isinstance ( x , errors . InvalidHeaderDefect ) for x in token . all_defects ) : mailbox . token_type = 'invalid-mailbox' mailbox . append ( token ) return mailbox , value