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