from itertools import groupby
x = {'bathroom': 'a', 'bedroom1': 'a', 'kitchen': 'b'}
{','.join(i[0] for i in v): k for k, v in groupby(sorted(iter(x.items()), key
    =lambda p: p[1]), lambda p: p[1])}
Merging dictionary keys if values the same