def METHOD_NAME(user_dir, user):
    posts = Post.objects.filter(author=user).select_related("author", "topic")
    for post in posts:
        post_dir = os.path.join(user_dir, f"posts/{post.slug}")
        os.makedirs(post_dir)
        with open(os.path.join(post_dir, f"{post.slug}.md"), "w", encoding="utf-8") as f:
            f.write(post_to_md(post))
        with open(os.path.join(post_dir, f"{post.slug}.json"), "w", encoding="utf-8") as f:
            f.write(json.dumps(post_to_json(post), ensure_ascii=False))
        # dump post comments
        post_comments = Comment.objects.filter(post=post).select_related("author", "post")
        with open(os.path.join(post_dir, f"comments.json"), "w", encoding="utf-8") as f:
            f.write(json.dumps(comments_to_json(post_comments), ensure_ascii=False))