code: def atomic_shelve(filename):
      with _lock(filename):
          shelved = shelve.open(filename)
          yield shelved
          shelved.close()
  
imports: from contextlib import contextmanager
  import shelve
  from filelock import FileLock
label_desc: Use image node_id 2 for calling a global function with example usage: atomic_shelve(filename) without return types