def succ_item(self, key, default=_sentinel):
<EOL>node = self._root<EOL>succ_node = None<EOL>while node is not None:<EOL><INDENT>cmp = self._cmp(self._cmp_data, key, node.key)<EOL>if cmp == <NUM_LIT:0>:<EOL><INDENT>break<EOL><DEDENT>elif cmp < <NUM_LIT:0>:<EOL><INDENT>if (succ_node is None) or self._cmp(self._cmp_data, node.key, succ_node.key) < <NUM_LIT:0>:<EOL><INDENT>succ_node = node<EOL><DEDENT>node = node.left<EOL><DEDENT>else:<EOL><INDENT>node = node.right<EOL><DEDENT><DEDENT>if node is None:  <EOL><INDENT>if default is _sentinel:<EOL><INDENT>raise KeyError(str(key))<EOL><DEDENT>return default<EOL><DEDENT>if node.right is not None:<EOL><INDENT>node = node.right<EOL>while node.left is not None:<EOL><INDENT>node = node.left<EOL><DEDENT>if succ_node is None:<EOL><INDENT>succ_node = node<EOL><DEDENT>elif self._cmp(self._cmp_data, node.key, succ_node.key) < <NUM_LIT:0>:<EOL><INDENT>succ_node = node<EOL><DEDENT><DEDENT>elif succ_node is None:  <EOL><INDENT>if default is _sentinel:<EOL><INDENT>raise KeyError(str(key))<EOL><DEDENT>return default<EOL><DEDENT>return succ_node.key, succ_node.value<EOL>
Get successor (k,v) pair of key, raises KeyError if key is max key
        or key does not exist. optimized for pypy.