docs: def dump_limits(conf_file, limits_file, debug=False):
      """
      Dump the current limits from the Redis database.
  
      :param conf_file: Name of the configuration file, for connecting
                        to the Redis database.
      :param limits_file: Name of the XML file that the limits will be
                          dumped to.  Use '-' to dump to stdout.
      :param debug: If True, debugging messages are emitted while
                    dumping the limits.
      """
  
      # Connect to the database...
      conf = config.Config(conf_file=conf_file)
      db = conf.get_database()
      limits_key = conf['control'].get('limits_key', 'limits')
  
      # Now, grab all the limits
      lims = [limits.Limit.hydrate(db, msgpack.loads(lim))
              for lim in db.zrange(limits_key, 0, -1)]
  
      # Build up the limits tree
      root = etree.Element('limits')
      limit_tree = etree.ElementTree(root)
      for idx, lim in enumerate(lims):
          if debug:
              print >>sys.stderr, "Dumping limit index %d: %r" % (idx, lim)
          make_limit_node(root, lim)
  
      # Write out the limits file
      if limits_file == '-':
          limits_file = sys.stdout
      if debug:
          print >>sys.stderr, "Dumping limits to file %r" % limits_file
      limit_tree.write(limits_file, xml_declaration=True, encoding='UTF-8',
                       pretty_print=True)