def change_directory(dir, datadir):
    "changes directory"
    d = os.path.join(os.getcwd(), dir)

    # dont cd out of datadir
    if d not in datadir:
        d = datadir

    # if empty, switch to datadir
    if not dir:
        d = datadir

    # switch to dir
    try:
        os.chdir(d)
        return d
    except OSError:
        print("Error: Directory %s not found" % dir)
dataset/ETHPy150Open noqqe/cmddocs/cmddocs/articles.py/change_directory/swapped operands of `not in`