def multiset(seq):
 rv = defaultdict(int)
 for s in seq:
  rv[s] += 1
 return dict(rv)

def multiset ( seq ) : rv = defaultdict ( int ) for s in seq : rv [ s ] += 1 return dict ( rv )
return the hashable sequence in multiset form with values being the multiplicity of the item in the sequence .