def METHOD_NAME(tmp_path):
    def write_policy(filename, data):
        full_path = os.path.join(tmp_path, filename)
        os.makedirs(os.path.dirname(full_path), exist_ok=True)
        with open(full_path, "w") as f:
            json.dump(data, f)
    return write_policy