<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_error(code, context="client"):
 """ check if the error code is set. If so, a Python log message is generated and an error is raised. """

    if code:
        error = error_text(code, context)
        logger.error(error)
        raise Snap7Exception(error)