def __init__(<EOL>self,<EOL>string: Union[MutableSequence[str], str],<EOL>_type_to_spans: Dict[str, List[List[int]]] = None,<EOL>) -> None:
if _type_to_spans is not None:<EOL><INDENT>self._type_to_spans = _type_to_spans<EOL>self._lststr = string  <EOL>return<EOL><DEDENT>self._lststr = [string]<EOL>span = self._span = [<NUM_LIT:0>, len(string)]<EOL>byte_array = bytearray(string, '<STR_LIT:ascii>', '<STR_LIT:replace>')<EOL>_type = self._type<EOL>if _type not in SPAN_PARSER_TYPES:<EOL><INDENT>type_to_spans = self._type_to_spans = parse_to_spans(byte_array)<EOL>type_to_spans[_type] = [span]<EOL>self._shadow_cache = string, byte_array<EOL><DEDENT>else:<EOL><INDENT>head = byte_array[:<NUM_LIT:2>]<EOL>tail = byte_array[-<NUM_LIT:2>:]<EOL>byte_array[-<NUM_LIT:2>:] = byte_array[:<NUM_LIT:2>] = b'<STR_LIT>'<EOL>type_to_spans = parse_to_spans(byte_array)<EOL>self._shadow_cache = string, byte_array<EOL>type_to_spans[_type].insert(<NUM_LIT:0>, span)<EOL>self._type_to_spans = type_to_spans<EOL>byte_array[:<NUM_LIT:2>] = head<EOL>byte_array[-<NUM_LIT:2>:] = tail<EOL><DEDENT>
Initialize the object.

        Set the initial values for self._lststr, self._type_to_spans.

        :param string: The string to be parsed or a list containing the string
            of the parent object.
        :param _type_to_spans: If the lststr is already parsed, pass its
            _type_to_spans property as _type_to_spans to avoid parsing it
            again.