code: def camel_to_snake_case(name: str) -> str:
      """Convert a ``CamelCase`` name to ``snake_case``."""
      name = re.sub(
          r"((?<=[a-z0-9])[A-Z]|(?!^)[A-Z](?=[a-z]))", r"_\1", name
      )
      return name.lower().lstrip("_")
  
imports: from __future__ import annotations
  import re
  import typing
  import sqlalchemy
  import sqlalchemy.orm
  from .query import Query
label_desc: Use image node_id 2 for calling a global function with example usage: camel_to_snake_case(name) and returns: name