def load_existing_json(dir=None):
        """
        Look for an existing json under dir (defaults to
        :meth:`logger.get_logger_dir()`) named "stats.json",
        and return the loaded list of statistics if found. Returns None otherwise.
        """
        if dir is None:
            dir = logger.get_logger_dir()
        fname = os.path.join(dir, JSONWriter.FILENAME)
        if tf.gfile.Exists(fname):
            with open(fname) as f:
                stats = json.load(f)
                assert isinstance(stats, list), type(stats)
                return stats
        return None

        Look for an existing json under dir (defaults to
        :meth:`logger.get_logger_dir()`) named "stats.json",
        and return the loaded list of statistics if found. Returns None otherwise.
        
tensorpack/callbacks/monitor.py