def handle_group(self, text, capture=None, is_format=False):
        """Handle groups."""

        if capture is None:
            capture = tuple() if self.is_bytes else ''

        if len(self.result) > 1:
            self.literal_slots.append("".join(self.result))
            if is_format:
                self.literal_slots.extend(["\\g<", text, ">"])
            else:
                self.literal_slots.append(text)
            del self.result[:]
            self.result.append("")
            self.slot += 1
        elif is_format:
            self.literal_slots.extend(["\\g<", text, ">"])
        else:
            self.literal_slots.append(text)

        self.group_slots.append(
            (
                self.slot,
                (
                    (self.span_stack[-1] if self.span_stack else None),
                    self.get_single_stack(),
                    capture
                )
            )
        )
        self.slot += 1
def handle_group ( self , text , capture = None , is_format = False ) : if capture is None : capture = tuple ( ) if self . is_bytes else '' if len ( self . result ) > 1 : self . literal_slots . append ( "" . join ( self . result ) ) if is_format : self . literal_slots . extend ( [ "\\g<" , text , ">" ] ) else : self . literal_slots . append ( text ) del self . result [ : ] self . result . append ( "" ) self . slot += 1 elif is_format : self . literal_slots . extend ( [ "\\g<" , text , ">" ] ) else : self . literal_slots . append ( text ) self . group_slots . append ( ( self . slot , ( ( self . span_stack [ - 1 ] if self . span_stack else None ) , self . get_single_stack ( ) , capture ) ) ) self . slot += 1
Handle groups.