nodes: 0, module; 1, function_definition; 2, function_name:inorder; 3, parameters; 4, block; 5, list_splat_pattern; 6, dictionary_splat_pattern; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# default = identity; 11, if_statement; 12, expression_statement; 13, for_statement; 14, if_statement; 15, if_statement; 16, expression_statement; 17, if_statement; 18, comment:# exactly one sequence remains, short circuit and drain it; 19, expression_statement; 20, expression_statement; 21, while_statement; 22, identifier:iterables; 23, identifier:kwargs; 24, comment:"""
  	A generator that yields the values from several ordered iterables
  	in order.
  
  	Example:
  
  	>>> x = [0, 1, 2, 3]
  	>>> y = [1.5, 2.5, 3.5, 4.5]
  	>>> z = [1.75, 2.25, 3.75, 4.25]
  	>>> list(inorder(x, y, z))
  	[0, 1, 1.5, 1.75, 2, 2.25, 2.5, 3, 3.5, 3.75, 4.25, 4.5]
  	>>> list(inorder(x, y, z, key=lambda x: x * x))
  	[0, 1, 1.5, 1.75, 2, 2.25, 2.5, 3, 3.5, 3.75, 4.25, 4.5]
  
  	>>> x.sort(key=lambda x: abs(x-3))
  	>>> y.sort(key=lambda x: abs(x-3))
  	>>> z.sort(key=lambda x: abs(x-3))
  	>>> list(inorder(x, y, z, key=lambda x: abs(x - 3)))
  	[3, 2.5, 3.5, 2.25, 3.75, 2, 1.75, 4.25, 1.5, 4.5, 1, 0]
  
  	>>> x = [3, 2, 1, 0]
  	>>> y = [4.5, 3.5, 2.5, 1.5]
  	>>> z = [4.25, 3.75, 2.25, 1.75]
  	>>> list(inorder(x, y, z, reverse = True))
  	[4.5, 4.25, 3.75, 3.5, 3, 2.5, 2.25, 2, 1.75, 1.5, 1, 0]
  	>>> list(inorder(x, y, z, key = lambda x: -x))
  	[4.5, 4.25, 3.75, 3.5, 3, 2.5, 2.25, 2, 1.75, 1.5, 1, 0]
  
  	NOTE:  this function will never reverse the order of elements in
  	the input iterables.  If the reverse keyword argument is False (the
  	default) then the input sequences must yield elements in increasing
  	order, likewise if the keyword argument is True then the input
  	sequences must yield elements in decreasing order.  Failure to
  	adhere to this yields undefined results, and for performance
  	reasons no check is performed to validate the element order in the
  	input sequences.
  	"""; 25, assignment; 26, assignment; 27, identifier:kwargs; 28, block; 29, assignment; 30, identifier:iterable; 31, identifier:iterables; 32, block; 33, not_operator; 34, comment:# all sequences are empty; 35, block; 36, identifier:reverse; 37, block; 38, else_clause; 39, assignment; 40, comparison_operator:len(nextvals) > 1; 41, block; 42, assignment; 43, yield; 44, integer:1; 45, block; 46, identifier:reverse; 47, call; 48, identifier:keyfunc; 49, call; 50, raise_statement; 51, identifier:nextvals; 52, dictionary; 53, expression_statement; 54, try_statement; 55, identifier:nextvals; 56, return_statement; 57, expression_statement; 58, block; 59, identifier:values; 60, attribute; 61, call; 62, integer:1; 63, while_statement; 64, pattern_list; 65, call; 66, identifier:val; 67, expression_statement; 68, attribute; 69, argument_list; 70, attribute; 71, argument_list; 72, call; 73, assignment; 74, block; 75, except_clause; 76, assignment; 77, expression_statement; 78, identifier:nextvals; 79, identifier:itervalues; 80, identifier:len; 81, argument_list; 82, integer:1; 83, block; 84, tuple_pattern; 85, identifier:values; 86, argument_list; 87, yield; 88, identifier:kwargs; 89, identifier:pop; 90, string:"reverse"; 91, False; 92, identifier:kwargs; 93, identifier:pop; 94, string:"key"; 95, lambda; 96, identifier:TypeError; 97, argument_list; 98, identifier:next; 99, attribute; 100, expression_statement; 101, expression_statement; 102, identifier:StopIteration; 103, block; 104, identifier:select; 105, identifier:max; 106, assignment; 107, identifier:nextvals; 108, expression_statement; 109, expression_statement; 110, try_statement; 111, identifier:_; 112, identifier:val; 113, identifier:next; 114, call; 115, lambda_parameters; 116, identifier:x; 117, binary_operator:"invalid keyword argument '%s'" % kwargs.keys()[0]; 118, call; 119, identifier:next; 120, assignment; 121, assignment; 122, pass_statement; 123, identifier:select; 124, identifier:min; 125, assignment; 126, yield; 127, block; 128, except_clause; 129, identifier:next; 130, argument_list; 131, identifier:x; 132, string:"invalid keyword argument '%s'"; 133, subscript; 134, identifier:iter; 135, argument_list; 136, identifier:nextval; 137, call; 138, subscript; 139, expression_list; 140, pattern_list; 141, call; 142, identifier:val; 143, expression_statement; 144, expression_statement; 145, identifier:StopIteration; 146, block; 147, call; 148, integer:0; 149, identifier:iterable; 150, identifier:next; 151, argument_list; 152, identifier:nextvals; 153, identifier:next; 154, call; 155, identifier:nextval; 156, identifier:next; 157, identifier:_; 158, identifier:val; 159, identifier:next; 160, identifier:select; 161, argument_list; 162, assignment; 163, assignment; 164, delete_statement; 165, if_statement; 166, attribute; 167, argument_list; 168, identifier:keyfunc; 169, argument_list; 170, call; 171, identifier:nextval; 172, call; 173, subscript; 174, expression_list; 175, subscript; 176, comparison_operator:len(nextvals) < 2; 177, block; 178, identifier:kwargs; 179, identifier:keys; 180, identifier:nextval; 181, identifier:values; 182, argument_list; 183, identifier:next; 184, argument_list; 185, identifier:nextvals; 186, identifier:next; 187, call; 188, identifier:nextval; 189, identifier:next; 190, identifier:nextvals; 191, identifier:next; 192, call; 193, integer:2; 194, break_statement; 195, identifier:keyfunc; 196, argument_list; 197, identifier:len; 198, argument_list; 199, identifier:nextval; 200, identifier:nextvals
code: def inorder(*iterables, **kwargs):
  	"""
  	A generator that yields the values from several ordered iterables
  	in order.
  
  	Example:
  
  	>>> x = [0, 1, 2, 3]
  	>>> y = [1.5, 2.5, 3.5, 4.5]
  	>>> z = [1.75, 2.25, 3.75, 4.25]
  	>>> list(inorder(x, y, z))
  	[0, 1, 1.5, 1.75, 2, 2.25, 2.5, 3, 3.5, 3.75, 4.25, 4.5]
  	>>> list(inorder(x, y, z, key=lambda x: x * x))
  	[0, 1, 1.5, 1.75, 2, 2.25, 2.5, 3, 3.5, 3.75, 4.25, 4.5]
  
  	>>> x.sort(key=lambda x: abs(x-3))
  	>>> y.sort(key=lambda x: abs(x-3))
  	>>> z.sort(key=lambda x: abs(x-3))
  	>>> list(inorder(x, y, z, key=lambda x: abs(x - 3)))
  	[3, 2.5, 3.5, 2.25, 3.75, 2, 1.75, 4.25, 1.5, 4.5, 1, 0]
  
  	>>> x = [3, 2, 1, 0]
  	>>> y = [4.5, 3.5, 2.5, 1.5]
  	>>> z = [4.25, 3.75, 2.25, 1.75]
  	>>> list(inorder(x, y, z, reverse = True))
  	[4.5, 4.25, 3.75, 3.5, 3, 2.5, 2.25, 2, 1.75, 1.5, 1, 0]
  	>>> list(inorder(x, y, z, key = lambda x: -x))
  	[4.5, 4.25, 3.75, 3.5, 3, 2.5, 2.25, 2, 1.75, 1.5, 1, 0]
  
  	NOTE:  this function will never reverse the order of elements in
  	the input iterables.  If the reverse keyword argument is False (the
  	default) then the input sequences must yield elements in increasing
  	order, likewise if the keyword argument is True then the input
  	sequences must yield elements in decreasing order.  Failure to
  	adhere to this yields undefined results, and for performance
  	reasons no check is performed to validate the element order in the
  	input sequences.
  	"""
  	reverse = kwargs.pop("reverse", False)
  	keyfunc = kwargs.pop("key", lambda x: x) # default = identity
  	if kwargs:
  		raise TypeError("invalid keyword argument '%s'" % kwargs.keys()[0])
  	nextvals = {}
  	for iterable in iterables:
  		next = iter(iterable).next
  		try:
  			nextval = next()
  			nextvals[next] = keyfunc(nextval), nextval, next
  		except StopIteration:
  			pass
  	if not nextvals:
  		# all sequences are empty
  		return
  	if reverse:
  		select = max
  	else:
  		select = min
  	values = nextvals.itervalues
  	if len(nextvals) > 1:
  		while 1:
  			_, val, next = select(values())
  			yield val
  			try:
  				nextval = next()
  				nextvals[next] = keyfunc(nextval), nextval, next
  			except StopIteration:
  				del nextvals[next]
  				if len(nextvals) < 2:
  					break
  	# exactly one sequence remains, short circuit and drain it
  	(_, val, next), = values()
  	yield val
  	while 1:
  		yield next()