code: def recordtree(table, start='start', stop='stop'):
      
  
      import intervaltree
      getstart = attrgetter(start)
      getstop = attrgetter(stop)
      tree = intervaltree.IntervalTree()
      for rec in records(table):
          tree.addi(getstart(rec), getstop(rec), rec)
      return tree
docs: Construct an interval tree for the given table, where each node in the
      tree is a row of the table represented as a record object.