<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def trap_exceptions(results, handler, exceptions=Exception):
 	""" 	Iterate through the results, but if an exception occurs, stop 	processing the results and instead replace 	the results with the output from the exception handler. 	"""

	try:
		for result in results:
			yield result
	except exceptions as exc:
		for result in always_iterable(handler(exc)):
			yield result