code: def _resdef_for_dep(depdef, flag_vals):
      if depdef.inline_resource:
          return depdef.inline_resource, depdef.opdef.guildfile.dir
      res_spec = util.resolve_refs(depdef.spec, flag_vals)
      return util.find_apply(
          [
              _model_resource,
              _guildfile_resource,
              _package_resource,
              _invalid_dependency_error,
          ],
          res_spec,
          depdef,
      )
  
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 9 for calling a global function with example usage: _resdef_for_dep(depdef, flag_vals) and returns: util, depdef,  depdef