def forbid_multi_line_headers(name, val):
    val = force_unicode(val)
    if '\n' in val or '\r' in val:
        raise BadHeaderError("Header values can't contain newlines (got %r for header %r)" % (val, name))
    try:
        val = val.encode('ascii')
    except UnicodeEncodeError:
        if name.lower() in ('to', 'from', 'cc'):
            result = []
            for item in val.split(', '):
                nm, addr = parseaddr(item)
                nm = str(Header(nm, settings.DEFAULT_CHARSET))
                result.append(formataddr((nm, str(addr))))
            val = ', '.join(result)
        else:
            val = Header(val, settings.DEFAULT_CHARSET)
    else:
        if name.lower() == 'subject':
            val = Header(val)
    return name, val
A set-specific equality assertion.
dataset/ETHPy150Open CollabQ/CollabQ/vendor/django/core/mail.py/forbid_multi_line_headers--crossover with--dataset/ETHPy150Open JetBrains/python-skeletons/nose/tools/__init__.py/assert_set_equal