code: def cwd_guildfile(cwd=None):
      """Returns the guildfile of the context cwd.
  
      Returns None if a guildfile doesn't exist in the cwd.
      """
      import guild.model  # expensive
  
      cwd = cwd or config.cwd()
      try:
          importer = guild.model.ModelImporter(cwd)
      except ImportError:
          return None
      else:
          _check_bad_guildfile(importer.dist)
          return getattr(importer.dist, "guildfile", None)
  
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 2 for calling a global function with example usage: cwd_guildfile(cwd) and returns: getattr, None