code: def archive_bird_conf(config_file, changes_counter):
      
      log = logging.getLogger(PROGRAM_NAME)
      history_dir = os.path.join(os.path.dirname(config_file), 'history')
      dst = os.path.join(history_dir, str(time.time()))
      log.debug("coping %s to %s", config_file, dst)
  
      history = [x for x in os.listdir(history_dir)
                 if os.path.isfile(os.path.join(history_dir, x))]
  
      if len(history) > changes_counter:
          log.info("threshold of %s is reached, removing old files",
                   changes_counter)
          for _file in sorted(history, reverse=True)[changes_counter - 1:]:
              _path = os.path.join(history_dir, _file)
              try:
                  os.remove(_path)
              except OSError as exc:
                  log.warning("failed to remove %s: %s", _file, exc)
              else:
                  log.info("removed %s", _path)
  
      try:
          shutil.copy2(config_file, dst)
      except OSError as exc:
          log.warning("failed to copy %s to %s: %s", config_file, dst, exc)
docs: Keep a history of Bird configuration files.
  
      Arguments:
          config_file (str): file name of bird configuration
          changes_counter (int): number of configuration files to keep in the
          history