code: def stamp(
      config: Config,
      revision: _RevIdType,
      sql: bool = False,
      tag: Optional[str] = None,
      purge: bool = False,
  ) -> None:
      """'stamp' the revision table with the given revision; don't
      run any migrations.
  
      :param config: a :class:`.Config` instance.
  
      :param revision: target revision or list of revisions.   May be a list
       to indicate stamping of multiple branch heads.
  
       .. note:: this parameter is called "revisions" in the command line
          interface.
  
      :param sql: use ``--sql`` mode
  
      :param tag: an arbitrary "tag" that can be intercepted by custom
       ``env.py`` scripts via the :class:`.EnvironmentContext.get_tag_argument`
       method.
  
      :param purge: delete all entries in the version table before stamping.
  
      """
  
      script = ScriptDirectory.from_config(config)
  
      if sql:
          destination_revs = []
          starting_rev = None
          for _revision in util.to_list(revision):
              if ":" in _revision:
                  srev, _revision = _revision.split(":", 2)
  
                  if starting_rev != srev:
                      if starting_rev is None:
                          starting_rev = srev
                      else:
                          raise util.CommandError(
                              "Stamp operation with --sql only supports a "
                              "single starting revision at a time"
                          )
              destination_revs.append(_revision)
      else:
          destination_revs = util.to_list(revision)
  
      def do_stamp(rev, context):
          return script._stamp_revs(
              util.to_tuple(destination_revs), rev
          )
  
      with EnvironmentContext(
          config,
          script,
          fn=do_stamp,
          as_sql=sql,
          starting_rev=starting_rev if sql else None,
          destination_rev=util.to_tuple(destination_revs),
          tag=tag,
          purge=purge,
      ):
          script.run_env()
  
imports: from __future__ import annotations
  import os
  from typing import List
  from typing import Optional
  from typing import TYPE_CHECKING
  from typing import Union
  from .None import autogenerate
  from .None import util
  from .runtime.environment import EnvironmentContext
  from .script import ScriptDirectory
label_desc: Use image node_id 13 for calling a global function with example usage: stamp(config, revision, sql, tag, purge) and returns: script