code: def getWorkDirs():
    
    # get caller module
    caller_fullurl = inspect.stack()[1][1]
    caller_relurl = os.path.relpath(caller_fullurl)
    caller_modurl = os.path.splitext(caller_relurl)[0]
    # split caller_url & append 'Dir' to package name
    dirs = caller_modurl.split('/')
    dirs[0] = 'data' # TODO de-hardcode
    # get, check and create outdir
    outDir = os.path.join(*(['output'] + dirs[1:]))
    if not os.path.exists(outDir): os.makedirs(outDir)
    # get and check indir
    dirs.append('input')
    inDir = os.path.join(*dirs)
    if not os.path.exists(inDir):
      logging.critical('create input dir %s to continue!' % inDir)
      sys.exit(1)
    return inDir, outDir
docs: get input/output dirs (same input/output layout as for package)