code: def camel_to_snake(name: str) -> str:
      """Convert CamelCase to snake_case, handling acronyms properly."""
      out = name[0].lower()
      for c0, c1, c2 in zip(name[:-2], name[1:-1], name[2:]):
          # Catch lower->upper transitions.
          if not c0.isupper() and c1.isupper():
              out += "_"
          # Catch acronym endings.
          if c0.isupper() and c1.isupper() and c2.islower():
              out += "_"
          out += c1.lower()
      out += name[-1].lower()
      return out
  
imports: import argparse
  import json
  import os
  import re
  import sys
  from typing import List, Optional, Tuple
label_desc: Use image node_id 1 for calling a global function with example usage: camel_to_snake(name) and returns: out