code: def fail(self, msg, shutit_pexpect_child=None, throw_exception=False):
  		
  		shutit_global.shutit_global_object.yield_to_draw()
  		# Note: we must not default to a child here
  		if shutit_pexpect_child is not None:
  			shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)
  			shutit_util.print_debug(sys.exc_info())
  			shutit_pexpect_session.pause_point('Pause point on fail: ' + msg, color='31')
  		if throw_exception:
  			sys.stderr.write('Error caught: ' + msg + '\n')
  			sys.stderr.write('\n')
  			shutit_util.print_debug(sys.exc_info())
  			raise ShutItFailException(msg)
  		else:
  			# This is an "OK" failure, ie we don't need to throw an exception.
  			# However, it's still a "failure", so return 1
  			shutit_global.shutit_global_object.handle_exit(exit_code=1,msg=msg)
  		shutit_global.shutit_global_object.yield_to_draw()
docs: Handles a failure, pausing if a pexpect child object is passed in.
  
  		@param shutit_pexpect_child: pexpect child to work on
  		@param throw_exception: Whether to throw an exception.
  		@type throw_exception: boolean