You don't need the ".keys()" part. If it's a dictionary, just say "p not in oldrevdeplst" and it will do the same thing.