code: def _renamed_source_path(name, rename, resolve_flag_refs):
      for spec in rename:
          try:
              pattern = resolve_flag_refs(spec.pattern)
              repl = resolve_flag_refs(spec.repl)
          except resolverlib.ResolutionError as e:
              raise OpDependencyError(
                  (
                      f"error renaming source {name} ({spec.pattern!r} -> "
                      f"{spec.repl!r}): resolution error: {e}"
                  )
              ) from None
  
          try:
              renamed = re.sub(pattern, repl, name, count=1)
          except Exception as e:
              raise OpDependencyError(
                  f"error renaming source {name} ({pattern!r} -> {repl!r}): {e}"
              ) from None
          else:
              if renamed != name:
                  return renamed
      return name
  
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 33 for calling a global function with example usage: _renamed_source_path(name, rename, resolve_flag_refs) and returns: name, renamed