def matchingDict(d, selection, require_existence=False):
    """ Determines if the dictionary d conforms to the specified selection,
    i.e. if a (key, x) is in the selection, then if key is in d as well it must be x
    or contained in x (if x is a list). """
    for k, v in list(selection.items()):
        if d in k:
            if isinstance(v, list):
                if d[k] not in v:
                    return False
            else:
                if d[k] != v:
                    return False
        elif require_existence:
            return False
    return True
dataset/ETHPy150Open pybrain/pybrain/pybrain/utilities.py/matchingDict/swapped operands of `in`