def _except(maybe_exception, if_exception): try: return maybe_exception() except Exception as e: return if_exception(str(e))