def intersectingPoint(self, p):
    """
    given a point, get intervals in the tree that are intersected.

    :param p: intersection point
    :return: the list of intersected intervals
    """
    # perfect match
    if p == self.data.mid:
      return self.data.ends

    if p > self.data.mid:
      # we know all intervals in self.data begin before p (if they began after
      # p, they would have not included mid) we just need to find those that
      # end after p
      endAfterP = [r for r in self.data.ends
                   if (r.end >= p and not self.openEnded) or
                   (r.end > p and self.openEnded)]
      if self.right is not None:
        endAfterP.extend(self.right.intersectingPoint(p))
      return endAfterP

    if p < self.data.mid:
      # we know all intervals in self.data end after p (if they ended before p,
      # they would have not included mid) we just need to find those that start
      # before p
      startBeforeP = [r for r in self.data.starts if r.start <= p]
      if self.left is not None:
        startBeforeP.extend(self.left.intersectingPoint(p))
      return startBeforeP
def intersectingPoint ( self , p ) : if p == self . data . mid : return self . data . ends if p > self . data . mid : endAfterP = [ r for r in self . data . ends if ( r . end >= p and not self . openEnded ) or ( r . end > p and self . openEnded ) ] if self . right is not None : endAfterP . extend ( self . right . intersectingPoint ( p ) ) return endAfterP if p < self . data . mid : startBeforeP = [ r for r in self . data . starts if r . start <= p ] if self . left is not None : startBeforeP . extend ( self . left . intersectingPoint ( p ) ) return startBeforeP
given a point, get intervals in the tree that are intersected.

    :param p: intersection point
    :return: the list of intersected intervals