in python/moz/l10n/formats/ini/serialize.py [0:0]
def comment(comment: str, meta: Any, standalone: bool) -> Iterator[str]:
nonlocal at_empty_line
if trim_comments:
return
if meta:
raise ValueError("Metadata is not supported")
if comment:
if standalone and not at_empty_line:
yield "\n"
for line in comment.strip("\n").split("\n"):
if not line or line.isspace():
yield "#\n"
else:
line = line.rstrip() + "\n"
yield f"#{line}" if line.startswith("#") else f"# {line}"
if standalone:
yield "\n"
at_empty_line = True