docs: def contigsub(a,b):
    'find longest common substring. return its slice coordinates (in a and b; see last line) or None if not found'
    'a and b are token lists'
    common=commonelts(a,b); groupsa=groupelts(a,common); groupsb=groupelts(b,common)
    bestmatch=[None,None,0]; bslice=None
    for i in range(len(groupsb)):
      if not groupsb[i][0]: continue
      if len(groupsb[i])-1<=bestmatch[2]: continue # this whole segment can't beat our best match so far
      for j in range(len(groupsb[i])):
        match=seqingroups(groupsa,groupsb[i][j:])
        if match and match[2]>bestmatch[2]: bestmatch=match; bslice=[i,j,match[2]]
        if match and match[2]>=(len(groupsb[i])/2.0): break # i.e. this is as good as we're going to get for groupsb[i], skip the rest. TODO: write a test for this
    return None if not bestmatch[2] else (ungroupslice(groupsa,bestmatch),ungroupslice(groupsb,bslice))