code: def get_closest_dir(workdir):
      """
      returns the topmost already-existing directory in the given path
      erasing work-dirs should never progress above this file.
      Also returns the name of first non-existing dir for use as filename.
      """
      closest_dir = ""
      for wdi in path_split_all(workdir):
          if os.path.isdir(os.path.join(closest_dir, wdi)):
              closest_dir = os.path.join(closest_dir, wdi)
          else:
              break
      assert closest_dir != workdir
      return closest_dir, wdi
  
imports: import datetime
  import numpy
  import logging
  import os
  import shutil
  import sys
  import uuid
  import numpy
  from .None import pyll
  from contextlib import contextmanager
label_desc: Use image node_id 15 for calling a global function with example usage: get_closest_dir(workdir) and returns: closest_dir,  wdi