def mkdir(path, mode=0o777):
    if path.startswith('/pnfs/') and (prefer_grid or not pnfs_is_mounted):
        if debug:
            print('*** Larbatch_posix: Make directory for %s using ifdh.' % path)
        larbatch_utilities.ifdh_mkdir(path)
    else:
        if debug:
            print('*** Larbatch_posix: Make directory for %s using posix.' % path)
        os.mkdir(path, mode)
def makedirs(path, mode=0o777):
    if path.startswith('/pnfs/') and (prefer_grid or not pnfs_is_mounted):
        if debug:
            print('*** Larbatch_posix: Make directory recursively for %s using ifdh.' % path)

        # Make sure parent directory exists.

        np = os.path.normpath(path)    # Stip trailing '/', if present.
        parent = os.path.dirname(np)
        if not isdir(parent):
            makedirs(parent, mode)

        # Now make directory itself.

        larbatch_utilities.ifdh_mkdir(path)
    else:
        if debug:
            print('*** Larbatch_posix: Make directory recursively for %s using posix.' % path)
        os.makedirs(path, mode)