def _next_logdir(path):
    if (not os.path.exists(path)):
        os.makedirs(path)
    subdirs = [d for d in os.listdir(path) if opth.isdir(opth.join(path, d))]
    logdir = opth.join(path, ('run' + str(len(subdirs)).zfill(4)))
    if (not os.path.exists(logdir)):
        os.makedirs(logdir)
    return logdir
def _next_logdir(path):
    if (not os.path.exists(path)):
        os.makedirs(path)
    subdirs = [d for d in os.listdir(path) if opth.isdir(opth.join(path, d))]
    logdir = opth.join(path, ('run' + str(len(subdirs)).zfill(4)))
    if (not os.path.exists(logdir)):
        os.makedirs(logdir)
    return logdir