code: def inorder(*iterables, **kwargs):
  	reverse = kwargs.pop("reverse", False)
  	keyfunc = kwargs.pop("key", lambda x: x)
  	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:
  		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
  	(_, val, next), = values()
  	yield val
  	while 1:
  		yield next()