code: def _shared_resource_cache(guild_dir):
      seen = set()
      cur = os.path.dirname(guild_dir)
      while True:
          if cur in seen:
              break
          seen.add(cur)
          maybe_cache = os.path.join(
              cur, ".guild", "cache", "resources"
          )
          if os.path.exists(maybe_cache):
              return maybe_cache
          cur = os.path.dirname(cur)
      return os.path.join(
          os.path.expanduser("~"), ".guild", "cache", "resources"
      )
  
imports: import errno
  import logging
  import os
  from guild import guildfile
  from guild import util
label_desc: Use image node_id 6 for calling a global function with example usage: _shared_resource_cache(guild_dir) and returns: os, maybe_cache