Write a function to flatten a deeply nested dictionary representing a threaded comment structure into a flat list for rendering.
Each comment is a dictionary with id, body, and an optional replies list containing child comment dictionaries. Return a preorder list of dictionaries containing each comment's id, body, and nesting depth, without mutating the input. Preserve the order of replies.
def flatten_comments(comment):
id and body.replies is either absent or a list of valid comment dictionaries.def flatten_comments(comment):