Python implementation of interval tree