<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _is_valid_script_engine(zap, engine):
 """Check if given script engine is valid."""

    engine_names = zap.script.list_engines
    short_names = [e.split(' : ')[1] for e in engine_names]

    return engine in engine_names or engine in short_names