def print_help (self, file=None):
        from distutils.fancy_getopt import wrap_text
        
        if file is None:
            file = sys.stdout

        self.print_usage(file)

        # The help for each option consists of two parts:
        #   * the opt strings and metavars
        #     eg. ("-x", or "-fFILENAME, --file=FILENAME")
        #   * the user-supplied help string
        #     eg. ("turn on expert mode", "read data from FILENAME")
        #
        # If possible, we write both of these on the same line:
        #   -x      turn on expert mode
        # 
        # But if the opt string list is too long, we put the help
        # string on a second line, indented to the same column it would
        # start in if it fit on the first line.
        #   -fFILENAME, --file=FILENAME
        #           read data from FILENAME

        print >>file, "options:"
        width = 78                      # assume 80 cols for now

        option_help = []                # list of (string, string) tuples
        lengths = []

        for option in self.option_list:
            takes_value = option.takes_value()
            if takes_value:
                metavar = option.metavar or option.dest.upper()

            opts = []               # list of "-a" or "--foo=FILE" strings
            if option.help is SUPPRESS_HELP:
                continue

            if takes_value:
                for sopt in option._short_opts:
                    opts.append(sopt + metavar)
                for lopt in option._long_opts:
                    opts.append(lopt + "=" + metavar)
            else:
                for opt in option._short_opts + option._long_opts:
                    opts.append(opt)

            opts = ", ".join(opts)
            option_help.append((opts, option.help))
            lengths.append(len(opts))

        max_opts = min(max(lengths), 20)

        for (opts, help) in option_help:
            # how much to indent lines 2 .. N of help text
            indent_rest = 2 + max_opts + 2 
            help_width = width - indent_rest

            if len(opts) > max_opts:
                opts = "  " + opts + "\n"
                indent_first = indent_rest

            else:                       # start help on same line as opts
                opts = "  %-*s  " % (max_opts, opts)
                indent_first = 0

            file.write(opts)

            if help:
                help_lines = wrap_text(help, help_width)
                print >>file, "%*s%s" % (indent_first, "", help_lines[0])
                for line in help_lines[1:]:
                    print >>file, "%*s%s" % (indent_rest, "", line)
            elif opts[-1] != "\n":
                file.write("\n")

# class OptionParser
dataset/ETHPy150Open skyostil/tracy/src/generator/Cheetah/Utils/optik/option_parser.py/OptionParser.print_help/original