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