code: def _constraint_name(const, table):
      if isinstance(table, Column):
          # this path occurs for a CheckConstraint linked to a Column
  
          # for column-attached constraint, set another event
          # to link the column attached to the table as this constraint
          # associated with the table.
          event.listen(
              table,
              "after_parent_attach",
              lambda col, table: _constraint_name(const, table),
          )
  
      elif isinstance(table, Table):
          if isinstance(const.name, conv) or const.name is _NONE_NAME:
              return
  
          newname = _constraint_name_for_table(const, table)
          if newname:
              const.name = newname
  
imports: from __future__ import annotations
  import re
  from .None import events
  from .base import _NONE_NAME
  from .elements import conv
  from .schema import CheckConstraint
  from .schema import Column
  from .schema import Constraint
  from .schema import ForeignKeyConstraint
  from .schema import Index
  from .schema import PrimaryKeyConstraint
  from .schema import Table
  from .schema import UniqueConstraint
  from ..None import event
  from ..None import exc
label_desc: Use image node_id 4 for calling a global function with example usage: _constraint_name(const, table) without return types