code: def ensure_outdir_exists(filepath):
      
      outdir = os.path.dirname(filepath)
  
      if outdir and not os.path.exists(outdir):
          LOGGER.debug("Making output dir: %s", outdir)
          os.makedirs(outdir)
docs: Make dir to dump 'filepath' if that dir does not exist.
  
      :param filepath: path of file to dump