code: def print_help_page(bot, file=sys.stdout):
      
      def p(text):
          print(text, file=file)
      plugin = bot.get_plugin(Commands)
      title = "Available Commands for {nick} at {host}".format(**bot.config)
      p("=" * len(title))
      p(title)
      p("=" * len(title))
      p('')
      p('.. contents::')
      p('')
      modules = {}
      for name, (predicates, callback) in plugin.items():
          commands = modules.setdefault(callback.__module__, [])
          commands.append((name, callback, predicates))
  
      for module in sorted(modules):
          p(module)
          p('=' * len(module))
          p('')
          for name, callback, predicates in sorted(modules[module]):
              p(name)
              p('-' * len(name))
              p('')
              doc = callback.__doc__
              doc = doc.replace('%%', bot.config.cmd)
              for line in doc.split('\n'):
                  line = line.strip()
                  if line.startswith(bot.config.cmd):
                      line = '    ``{}``'.format(line)
                  p(line)
              if 'permission' in predicates:
                  p('*Require {0[permission]} permission.*'.format(predicates))
              if predicates.get('public', True) is False:
                  p('*Only available in private.*')
              p('')
docs: print help page