import os import pickle def get_database(PKL_PATH): database = {} if os.path.getsize(PKL_PATH) > 0: with open(PKL_PATH, "rb") as f: unpickler = pickle.Unpickler(f) database = unpickler.load() return database