population must be a sequence or set. for dicts use list(d) code example
Example: TypeError: Population must be a sequence or set. For dicts, use list(d).
d = {'a':1,'b':2}
random.sample(list(d), 1)
d = {'a':1,'b':2}
random.sample(list(d), 1)