def inner_merge(self, newseq, newdata, callback):
        '''
        Internal implementation function for merging, very similar in interface
        to merge_pkt, but concentrates on the nitty-gritty logic of merging, as
        opposed to the high-level logic of merge().

        Args:
        newseq = (seq_begin, seq_end)
        newdata = string, new data
        callback = see new_seq_callback in merge_pkt

        Returns:
        see merge_pkt
        '''
        # setup
        overlapped = False
        added_front_data = False
        added_back_data = False
        # front data?
        if (seq.lt(newseq[0], self.seq_start) and
            seq.lte(self.seq_start, newseq[1])):
            new_data_length = seq.subtract(self.seq_start, newseq[0])
            # slice out new data, stick it on the front
            self.data = newdata[:new_data_length] + self.data
            self.seq_start = newseq[0]
            # notifications
            overlapped = True
            added_front_data = True
            if callback:
                callback(newseq[0])
        # back data?
        if seq.lte(newseq[0], self.seq_end) and seq.lt(self.seq_end, newseq[1]):
            new_data_length = seq.subtract(newseq[1], self.seq_end)
            self.data += newdata[-new_data_length:]
            self.seq_end += new_data_length
            # notifications
            overlapped = True
            added_back_data = True
            if callback:
                # the first seq number of new data in the back
                back_seq_start = newseq[1] - new_data_length
                callback(back_seq_start)
        # completely inside?
        if (seq.lte(self.seq_start, newseq[0]) and
            seq.lte(newseq[1], self.seq_end)):
            overlapped = True
        # done
        return (overlapped, (added_front_data, added_back_data))
dataset/ETHPy150Open andrewf/pcap2har/pcap2har/tcp/chunk.py/Chunk.inner_merge/original