def save_to_metadata_file(cls, dirpath, key, value):
        """
        Store `key: value` in metadata file dict.
        """
        fullpath = os.path.join(dirpath, cls.metadata_filename)
        if os.path.exists(fullpath):
            d = pickle.load(open(fullpath, 'rb'))
            d.update({key: value})
            pickle.dump(d, open(fullpath, 'wb'))
        else:
            pickle.dump({key: value}, open(fullpath, 'wb'))