code: def _modeldef_resource(modeldef, res_name, opdef):
      resdef = modeldef.get_resource(res_name)
      if resdef is None:
          raise OpDependencyError(
              f"resource '{res_name}' required by operation "
              f"'{opdef.fullname}' is not defined"
          )
      return resdef, modeldef.guildfile.dir
  
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 11 for calling a global function with example usage: _modeldef_resource(modeldef, res_name, opdef) and returns: resdef,  modeldef