def f(xs): # vs is unbound return [(k, v) for v in vs for k, vs in xs.items()]