code: def maybe_write_output(
      lines: List[str], output: Optional[str]
  ) -> None:
      """Write lines to output, unless output would be unchanged."""
  
      text = "\n".join(lines) + "\n"
  
      if output is None:
          # Write to stdout.
          sys.stdout.write(text)
          return
  
      if os.path.exists(output):
          with open(output, "r") as f:
              if f.read() == text:
                  return
  
      with open(output, "w") as f:
          f.write(text)
  
imports: import argparse
  import json
  import os
  import re
  import sys
  from typing import List, Optional, Tuple
label_desc: Use image node_id 14 for calling a global function with example usage: maybe_write_output(lines, output) without return types