def wrap_message(message, width=MAX_LINE_LENGTH):
 lines = message.split('\n')
 wrapped_lines = [textwrap.fill(line, width, expand_tabs=False, replace_whitespace=False, drop_whitespace=False, break_on_hyphens=False) for line in lines]
 wrapped_message = '\n'.join(wrapped_lines)
 return wrapped_message

def wrap_message ( message , width = MAX_LINE_LENGTH ) : lines = message . split ( '\n' ) wrapped_lines = [ textwrap . fill ( line , width , expand_tabs = False , replace_whitespace = False , drop_whitespace = False , break_on_hyphens = False ) for line in lines ] wrapped_message = '\n' . join ( wrapped_lines ) return wrapped_message
rfc 2822 states that line lengths in emails must be less than 998 .