class QuFormatter(string.Formatter):

    def _quote(self, m):
        if not hasattr(self, 'quoted'):
            self.quoted = {}
key = '__q__' + str(len(self.quoted))
self.quoted[key] = m.group(2)
return '{' + m.group(1) + key + m.group(3) + '}'

def parse(self, format_string):
    return string.Formatter.parse(self, re.sub(
        '{([^}`]*)`([^}`]*)`([^}]*)}', self._quote, format_string))

def get_value(self, key, args, kwargs):
    if key.startswith('__q__'):
        key = self.quoted[key]
return string.Formatter.get_value(self, key, args, kwargs)
python string format() with dict with integer keys