def assure_directory_exists(path, is_file=False):
 if is_file:
  path = osp.dirname(path)
 if (not osp.isdir(path)):
  os.makedirs(path)
  return True
 return False

def assure_directory_exists ( path , is_file = False ) : if is_file : path = osp . dirname ( path ) if ( not osp . isdir ( path ) ) : os . makedirs ( path ) return True return False
assure that the directory pointed to by path exists .