def forbid_multi_line_headers(name, val, encoding):
 encoding = (encoding or settings.DEFAULT_CHARSET)
 val = force_text(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.encode('ascii')
 except UnicodeEncodeError:
  if (name.lower() in ADDRESS_HEADERS):
   val = ', '.join((sanitize_address(addr, encoding) for addr in getaddresses((val,))))
  else:
   val = Header(val, encoding).encode()
 else:
  if (name.lower() == 'subject'):
   val = Header(val).encode()
 return (name, val)

def forbid_multi_line_headers ( name , val , encoding ) : encoding = ( encoding or settings . DEFAULT_CHARSET ) val = force_text ( 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 . encode ( 'ascii' ) except UnicodeEncodeError : if ( name . lower ( ) in ADDRESS_HEADERS ) : val = ', ' . join ( ( sanitize_address ( addr , encoding ) for addr in getaddresses ( ( val , ) ) ) ) else : val = Header ( val , encoding ) . encode ( ) else : if ( name . lower ( ) == 'subject' ) : val = Header ( val ) . encode ( ) return ( name , val )
forbids multi-line headers .