code: def unique(id: str, ids: MutableSet[str]) -> str:
      """Ensure id is unique in set of ids. Append '_1', '_2'... if not"""
      while id in ids or not id:
          m = IDCOUNT_RE.match(id)
          if m:
              id = "%s_%d" % (m.group(1), int(m.group(2)) + 1)
          else:
              id = "%s_%d" % (id, 1)
      ids.add(id)
      return id
  
imports: from __future__ import annotations
  from .None import Extension
  from ..treeprocessors import Treeprocessor
  from ..util import code_escape, parseBoolValue, AMP_SUBSTITUTE, HTML_PLACEHOLDER_RE, AtomicString
  from ..treeprocessors import UnescapeTreeprocessor
  import re
  import html
  import unicodedata
  import xml.etree.ElementTree
  from typing import TYPE_CHECKING, Any, Iterator, MutableSet
label_desc: Use image node_id 3 for calling a global function with example usage: unique(id, ids) and returns: id