def findMatchIn(self, seglist, seg, tshift):
        """ Returns one segment from seglist that has the most overlap with seg.
            tshift will be added to the segment timestamp temporarily:
            this is used to adjusted for things like file timestamp
            differences, without affecting the stored segment.
        """
        #print("--- trying to match segment", seg, "(delayed by ", tshift, "s) in list", [(s[0], s[1]) for s in seglist])
        overlaps = [min(seg[1]+tshift, seg2[1]) - max(seg[0]+tshift, seg2[0]) for seg2 in seglist]
        mpos = np.argmax(overlaps)
        if overlaps[mpos]<=0:
            print("No match found for segment", seg)
            return([])
        m = seglist[mpos]
        m.overlap = overlaps[mpos]
        return(m)