def METHOD_NAME(self):
    class BarFormatter(string.Formatter):
        # returns an iterable that contains tuples of the form:
        # (literal_text, field_name, format_spec, conversion)
        def parse(self, format_string):
            for field in format_string.split('|'):
                if field[0] == '+':
                    # it's markup
                    field_name, _, format_spec = field[1:].partition(':')
                    yield '', field_name, format_spec, None
                else:
                    yield field, None, None, None
    fmt = BarFormatter()
    self.assertEqual(fmt.format('*|+0:^10s|*', 'foo'), '*   foo    *')