def ensure_dir_notexists(path):
    try:
        if os.path.exists(path):
            os.rmdir(path)
        return True
    except OSError as ose:
        # ignore if directory
        if ose.errno not in [errno.ENOENT, errno.ENOTEMPTY, errno.ENOTDIR]:
            return False
helper function, removes dir if it exists
dataset/ETHPy150Open vcstools/vcstools/src/vcstools/common.py/ensure_dir_notexists