code: def ensure_dir(*path):
      """Ensure a directory exists, making it if necessary.
  
      Returns the full path."""
      dirpath = pjoin(*path)
      if not isdir(dirpath):
          makedirs(dirpath)
      return dirpath
  
file_path: nipy/examples/ds105/ds105_util.py
imports: import os
  from os import listdir, makedirs
  from os.path import abspath, exists, isdir, splitext
  from os.path import join
  import numpy
  import pandas
  from nipy.io.api import load_image
label_desc: Use image node_id 9 for calling a global function with example usage: ensure_dir() and returns: dirpath