code: def modify_logging(input_fn, output_fn, min_level_value, max_level_value, restore, force):
      
      # read in all the lines
      logging.info('reading in %s' % input_fn)
      fh = open(input_fn, 'r')
      lines = fh.readlines()
      fh.close()
      original_contents = ''.join(lines)
  
      if restore:
          forwards = restore_logging
          backwards = disable_logging
      else:
          forwards = disable_logging
          backwards = restore_logging
  
      # apply the requested action
      new_contents = forwards(lines, min_level_value, max_level_value)
  
      # quietly check to see if we can undo what we just did (if not, the text
      # contains something we cannot translate [bug or limitation with this code])
      logging.disable(logging.CRITICAL)
      new_contents_undone = backwards(new_contents.splitlines(True), min_level_value, max_level_value)
      logging.disable(logging.DEBUG)
      if original_contents != new_contents_undone:
          base_str = 'We are unable to revert this action as expected'
          if force:
              logging.warning(base_str + " but -f was specified so we'll do it anyway.")
          else:
              logging.error(base_str + ', so we will not do it in the first place.  Pass -f to override this and make the change anyway.')
              return -1
  
      logging.info('writing the new contents to %s' % output_fn)
      fh = open(output_fn, 'w')
      fh.write(new_contents)
      fh.close()
      logging.info('done!')
      return 0
docs: Modifies logging statements in the specified file.