code: def _gen_apply_source(
      source_path, dest_path, replace_existing, apply_cb
  ):
      assert os.path.isabs(dest_path), dest_path
      source_path = util.strip_trailing_sep(source_path)
      if os.path.lexists(dest_path) or os.path.exists(dest_path):
          if not replace_existing:
              log.warning(
                  "%s already exists, skipping %s",
                  dest_path,
                  apply_cb.__name__,
              )
              raise _SourceSkipped(source_path, dest_path)
          log.debug("deleting existing source dest %s", dest_path)
          util.safe_rmtree(dest_path)
      util.ensure_dir(os.path.dirname(dest_path))
      log.debug(
          "resolving source %s as %s (%s)",
          source_path,
          dest_path,
          apply_cb.__name__,
      )
      apply_cb()
  
imports: import os
  import re
  import logging
  import typing
  from guild import cli
  from guild import resolver
  from guild import resourcedef
  from guild import util
label_desc: Use image node_id 34 for calling a global function with example usage: _gen_apply_source(source_path, dest_path, replace_existing, apply_cb) without return types