pure python implementation of interval tree