This is going to be and O(n*m) operation where n=size of data and m=size of result. These can both potentially be quite large. If we make the dictionaries hashable first and put them in a set, then check if x is in the set, this will be O(n+m), which is significantly better.