from collections import defaultdict
vals = defaultdict(lambda : '<unset>', {'bar': 'baz'})
"""foo is {foo} and bar is {bar}""".format_map(vals)
How do I format a string using a dictionary in python-3.x?