code: def longest_overlap(ovls):
      
  
      # Ovls know how to compare to each other.
      ovls = sorted(ovls)
  
      # I know this could be better but ovls wont be more than 50 or so.
      for i, s in enumerate(ovls):
          passing = True
  
          for l in ovls[i + 1:]:
              if s.start in Rng(l.start, l.end, rng=(True, True)) or \
                 s.end in Rng(l.start, l.end, rng=(True, True)):
                  passing = False
                  break
  
          if passing:
              yield s
docs: From a list of overlays if any overlap keep the longest.