def handle_read_header(self, byte):
(_, frmtcode, _, frmtidx, val) = self.util.find(byte)<EOL>template = self._templatelist[frmtidx - <NUM_LIT:1>]<EOL>segmenttype = template.value.segmenttype        <EOL>if segmenttype is SegmentType.SINGLE_BYTE:<EOL><INDENT>self._scstate = self.next_state_afterraw()<EOL>self._state = self.create_state(frmtcode, template);<EOL>self.events.append((self.value_event_type(EventType.VALUE), frmtcode, val))<EOL><DEDENT>elif segmenttype is SegmentType.HEADER_VALUE_PAIR:<EOL><INDENT>self._scstate = ScannerState.WAITING_FOR_VALUE<EOL>self._state = self.create_state(frmtcode, template, length=template.value.length * template.value.multiplier);<EOL><DEDENT>elif segmenttype is SegmentType.HEADER_WITH_LENGTH_VALUE_PAIR:<EOL><INDENT>length = val * template.value.multiplier<EOL>self._state = self.create_state(frmtcode, template, length=length);<EOL>if self._state[<NUM_LIT:1>].value.valuetype is ValueType.NESTED:                <EOL><INDENT>self.events.append((self._state[<NUM_LIT:1>].value.startevent, frmtcode, None))<EOL>if length is <NUM_LIT:0>:<EOL><INDENT>self._scstate = ScannerState.SEGMENT_ENDED<EOL><DEDENT>else:<EOL><INDENT>if template.value.multiplier is <NUM_LIT:2>:<EOL><INDENT>self.parentismap = <NUM_LIT:1><EOL>self.waitingforprop = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>self.parentismap = <NUM_LIT:0><EOL>self.waitingforprop = <NUM_LIT:0><EOL><DEDENT>self.push_state()<EOL>self._scstate = ScannerState.WAITING_FOR_HEADER<EOL><DEDENT><DEDENT>else:          <EOL><INDENT>if length is <NUM_LIT:0>:<EOL><INDENT>self.events.append((self.value_event_type(EventType.VALUE), self._state[<NUM_LIT:0>], self.empty_value(self._state[<NUM_LIT:0>])))<EOL>self._scstate = self.next_state_afterraw()<EOL><DEDENT>else:<EOL><INDENT>self._scstate = ScannerState.WAITING_FOR_VALUE<EOL><DEDENT><DEDENT><DEDENT>elif segmenttype is SegmentType.VARIABLE_LENGTH_VALUE:<EOL><INDENT>self._scstate = ScannerState.WAITING_FOR_LENGTH<EOL>self._state = self.create_state(frmtcode, template, length=template.value.length);<EOL><DEDENT>elif segmenttype is SegmentType.EXT_FORMAT:<EOL><INDENT>self._scstate = ScannerState.WAITING_FOR_LENGTH<EOL>self._state = self.create_state(frmtcode, template, length=template.value.length);<EOL><DEDENT>elif segmenttype is SegmentType.FIXED_EXT_FORMAT:<EOL><INDENT>self._state = self.create_state(frmtcode, template, length=template.value.length);<EOL>self._scstate = ScannerState.WAITING_FOR_EXT_TYPE<EOL><DEDENT>else:<EOL><INDENT>raise InvalidStateException(self._scstate, "<STR_LIT>")<EOL><DEDENT>
handle read of header and assign fetching the appropriate template that is needed to parse expected segment based on header
:param byte: