code: def _cmp(val, compare_to, regex):
      log.debug(
          "opref comparing %r to %r (regex=%r)", val, compare_to, regex
      )
      if not regex or compare_to == "+":
          return val == compare_to
      try:
          return re.match(rf"{compare_to}$", val)
      except Exception as e:
          log.warning(
              "error comparing %s using %s: %s", val, compare_to, e
          )
          return False
  
file_path: guildai/guild/opref.py
imports: import collections
  import logging
  import os
  import re
  from guild import util
label_desc: Use image node_id 7 for calling a global function with example usage: _cmp(val, compare_to, regex) and returns: unknown, re, False