def METHOD_NAME(user_dir, user):
    upvotes = PostVote.objects.filter(user=user).select_related("post")
    with open(os.path.join(user_dir, "upvotes.json"), "w", encoding="utf-8") as f:
        f.write(json.dumps(upvotes_to_json(upvotes), ensure_ascii=False))