code: def addOptions(parser, config=Config()):
      
      # Wrapper function that allows toil to be used with both the optparse and
      # argparse option parsing modules
      addLoggingOptions(parser)  # This adds the logging stuff.
      if isinstance(parser, ArgumentParser):
          def addGroup(headingString, bodyString):
              return parser.add_argument_group(headingString, bodyString).add_argument
  
          parser.register("type", "bool", lambda v: v.lower() == "true")  # Custom type for arg=True/False.
          _addOptions(addGroup, config)
      else:
          raise RuntimeError("Unanticipated class passed to addOptions(), %s. Expecting "
                             "argparse.ArgumentParser" % parser.__class__)
docs: Adds toil options to a parser object, either optparse or argparse.