nodes: 0, module; 1, function_definition; 2, function_name:insort_event_right; 3, parameters; 4, block; 5, identifier:self; 6, identifier:event; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, if_statement; 12, while_statement; 13, expression_statement; 14, identifier:lo; 15, integer:0; 16, identifier:hi; 17, None; 18, comment:"""Insert event in queue, and keep it sorted assuming queue is sorted.
  
      If event is already in queue, insert it to the right of the rightmost
      event (to keep FIFO order).
  
      Optional args lo (default 0) and hi (default len(a)) bound the
      slice of a to be searched.
  
      Args:
        event: a (time in sec since unix epoch, callback, args, kwds) tuple.
      """; 19, comparison_operator:lo < 0; 20, block; 21, comparison_operator:hi is None; 22, block; 23, comparison_operator:lo < hi; 24, block; 25, call; 26, identifier:lo; 27, integer:0; 28, raise_statement; 29, identifier:hi; 30, None; 31, expression_statement; 32, identifier:lo; 33, identifier:hi; 34, expression_statement; 35, if_statement; 36, attribute; 37, argument_list; 38, call; 39, assignment; 40, assignment; 41, comparison_operator:event[0] < self.queue[mid][0]; 42, block; 43, else_clause; 44, attribute; 45, identifier:insert; 46, identifier:lo; 47, identifier:event; 48, identifier:ValueError; 49, argument_list; 50, identifier:hi; 51, call; 52, identifier:mid; 53, binary_operator:(lo + hi) // 2; 54, subscript; 55, subscript; 56, expression_statement; 57, block; 58, identifier:self; 59, identifier:queue; 60, string; 61, identifier:len; 62, argument_list; 63, parenthesized_expression; 64, integer:2; 65, identifier:event; 66, integer:0; 67, subscript; 68, integer:0; 69, assignment; 70, expression_statement; 71, string_content:lo must be non-negative; 72, attribute; 73, binary_operator:lo + hi; 74, attribute; 75, identifier:mid; 76, identifier:hi; 77, identifier:mid; 78, assignment; 79, identifier:self; 80, identifier:queue; 81, identifier:lo; 82, identifier:hi; 83, identifier:self; 84, identifier:queue; 85, identifier:lo; 86, binary_operator:mid + 1; 87, identifier:mid; 88, integer:1
code: def insort_event_right(self, event, lo=0, hi=None):
      """Insert event in queue, and keep it sorted assuming queue is sorted.
  
      If event is already in queue, insert it to the right of the rightmost
      event (to keep FIFO order).
  
      Optional args lo (default 0) and hi (default len(a)) bound the
      slice of a to be searched.
  
      Args:
        event: a (time in sec since unix epoch, callback, args, kwds) tuple.
      """
  
      if lo < 0:
        raise ValueError('lo must be non-negative')
      if hi is None:
        hi = len(self.queue)
      while lo < hi:
        mid = (lo + hi) // 2
        if event[0] < self.queue[mid][0]:
          hi = mid
        else:
          lo = mid + 1
      self.queue.insert(lo, event)