def optwrap(text):
 if (not BODY_WIDTH):
  return text
 assert wrap, 'Requires Python 2.3.'
 result = ''
 newlines = 0
 for para in text.split('\n'):
  if (len(para) > 0):
   if ((para[0] != ' ') and (para[0] != '-') and (para[0] != '*')):
    for line in wrap(para, BODY_WIDTH):
     result += (line + '\n')
    result += '\n'
    newlines = 2
   elif (not onlywhite(para)):
    result += (para + '\n')
    newlines = 1
  elif (newlines < 2):
   result += '\n'
   newlines += 1
 return result

def optwrap ( text ) : if ( not BODY_WIDTH ) : return text assert wrap , 'Requires Python 2.3.' result = '' newlines = 0 for para in text . split ( '\n' ) : if ( len ( para ) > 0 ) : if ( ( para [ 0 ] != ' ' ) and ( para [ 0 ] != '-' ) and ( para [ 0 ] != '*' ) ) : for line in wrap ( para , BODY_WIDTH ) : result += ( line + '\n' ) result += '\n' newlines = 2 elif ( not onlywhite ( para ) ) : result += ( para + '\n' ) newlines = 1 elif ( newlines < 2 ) : result += '\n' newlines += 1 return result
wrap all paragraphs in the provided text .