value = {'a': '100', 'bits': {(1): 'alpha', (2): 'beta', (3): ['31', '32', 
    901]}}


class YourFormatter(Formatter):

    def get_value(self, field_name, args, kwargs):
        return kwargs.get(field_name, '')

def get_field(self, field_name, args, kwargs):
    first, rest = field_name._formatter_field_name_split()
obj = self.get_value(first, args, kwargs)
for is_attr, i in rest:
    if is_attr:
        obj = getattr(obj, i)
else:
    obj = obj.get(i, '')
return obj, first
fmt = YourFormatter()
fmt.format('a={a}, b1={bits[1]}, b31={bits[3]}, b9={bits[9]}', **value)
Строковые шаблоны Python Safe для вложенного объекта dict