code: def do_help(self, argv):
          
          if len(argv) > 1:  # asking for help on a particular command
              doc = None
              cmdname = self._get_canonical_cmd_name(argv[1]) or argv[1]
              if not cmdname:
                  return self.helpdefault(argv[1], False)
              else:
                  helpfunc = getattr(self, "help_" + cmdname, None)
                  if helpfunc:
                      doc = helpfunc()
                  else:
                      handler = self._get_cmd_handler(cmdname)
                      if handler:
                          doc = handler.__doc__
                      if doc is None:
                          return self.helpdefault(argv[1], handler != None)
          else:  # bare "help" command
              doc = self.__class__.__doc__  # try class docstring
              if doc is None:
                  # Try to provide some reasonable useful default help.
                  if self.cmdlooping: prefix = ""
                  else: prefix = self.name + ' '
                  doc = """Usage:
                      %sCOMMAND [ARGS...]
                      %shelp [COMMAND]
  
                  ${option_list}
                  ${command_list}
                  ${help_list}
                  """ % (prefix, prefix)
              cmdname = None
  
          if doc:  # *do* have help content, massage and print that
              doc = self._help_reindent(doc)
              doc = self._help_preprocess(doc, cmdname)
              doc = doc.rstrip() + '\n'  # trim down trailing space
              self.stdout.write(self._str(doc))
              self.stdout.flush()
docs: ${cmd_name}: give detailed help on a specific sub-command
  
          Usage:
              ${name} help [COMMAND]