class HashKV:
def __init__(self, k, v): self.k, self.v = k, v
def __hash__(self): return hash(self.k)
def __eq__(self, other): return self.k == other.k
def __repr__(self): return f'{self.k}: {self.v}'
search = {HashKV(1, '?')}
def identical_in(a, b): return next(iter(a)) is next(iter(b))
print(identical_in(search, search & {HashKV(1, 1)}))
print(identical_in(search, {HashKV(1, 1)} & search))
print(identical_in(search, search & {HashKV(1, 1), HashKV(2, 2)}))
print(identical_in(search, {HashKV(1, 1), HashKV(2, 2)} & search))