def subDict(d, allowedkeys, flip=False):
    """ Returns a new dictionary with a subset of the entries of d
    that have on of the (dis-)allowed keys."""
    res = {}
    for k, v in list(d.items()):
        if (allowedkeys in k) ^ flip:
            res[k] = v
    return res
dataset/ETHPy150Open pybrain/pybrain/pybrain/utilities.py/subDict/swapped operands of `in`