code: def handle_format(self, t, i):
          
  
          if t == '{':
              t = self.format_next(i)
              if t == '{':
                  self.get_single_stack()
                  self.result.append(t)
              else:
                  field, text = self.get_format(t, i)
                  self.handle_format_group(field, text)
          else:
              t = self.format_next(i)
              if t == '}':
                  self.get_single_stack()
                  self.result.append(t)
              else:
                  raise SyntaxError("Unmatched '}' at %d!" % (i.index - 2))
docs: Handle format.