code: def _dir_guildfile(dir, ctx):
      from guild import guildfile
  
      try:
          return guildfile.for_dir(dir)
      except guildfile.NoModels:
          if ctx:
              help_suffix = f" or '{click_util.cmd_help(ctx)}' for help"
          else:
              help_suffix = ""
          cli.error(
              f"{cwd_desc(dir)} does not contain a Guild file (guild.yml)\n"
              f"Try specifying a project path or package name{help_suffix}."
          )
      except guildfile.GuildfileError as e:
          cli.error(str(e))
  
imports: import logging
  import os
  import typing
  from guild import cli
  from guild import click_util
  from guild import config
label_desc: Use image node_id 11 for calling a global function with example usage: _dir_guildfile(dir, ctx) and returns: guildfile