def METHOD_NAME(doc, record_module=None, create_init=True, folder_name=None):
	doc_export = doc.as_dict(no_nulls=True)
	doc.run_method("before_export", doc_export)
	doc_export = strip_default_fields(doc, doc_export)
	module = record_module or get_module_name(doc)
	# create folder
	if folder_name:
		folder = create_folder(module, folder_name, doc.name, create_init)
	else:
		folder = create_folder(module, doc.doctype, doc.name, create_init)
	fname = scrub(doc.name)
	write_code_files(folder, fname, doc, doc_export)
	# write the data file
	path = os.path.join(folder, f"{fname}.json")
	with open(path, "w+") as txtfile:
		txtfile.write(frappe.as_json(doc_export))
	print(f"Wrote document file for {doc.doctype} {doc.name} at {path}")