def formatDefinitions(options, COLS, presets = {}):
    s = StringIO()
    for (longname, default, doc) in options:
        s.write('--' + longname + ' <arg>\n')
        default = presets.get(longname, default)
        if type(default) in (IntType, LongType):
            try:
                default = int(default)
            except:
                pass
        if default is not None:
            doc += ' (defaults to ' + repr(default) + ')'
        s.write(splitLine(doc,COLS,10))
        s.write('\n\n')
    return s.getvalue()
dataset/ETHPy150Open Cclleemm/FriendlyTorrent/src/tornado/BitTornado/parseargs.py/formatDefinitions/original