def eval_gpr(expr, knockouts):
if isinstance(expr, Expression):<EOL><INDENT>return eval_gpr(expr.body, knockouts)<EOL><DEDENT>elif isinstance(expr, Name):<EOL><INDENT>return expr.id not in knockouts<EOL><DEDENT>elif isinstance(expr, BoolOp):<EOL><INDENT>op = expr.op<EOL>if isinstance(op, Or):<EOL><INDENT>return any(eval_gpr(i, knockouts) for i in expr.values)<EOL><DEDENT>elif isinstance(op, And):<EOL><INDENT>return all(eval_gpr(i, knockouts) for i in expr.values)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>" + op.__class__.__name__)<EOL><DEDENT><DEDENT>elif expr is None:<EOL><INDENT>return True<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>" + repr(expr))<EOL><DEDENT>
evaluate compiled ast of gene_reaction_rule with knockouts

    Parameters
    ----------
    expr : Expression
        The ast of the gene reaction rule
    knockouts : DictList, set
        Set of genes that are knocked out

    Returns
    -------
    bool
        True if the gene reaction rule is true with the given knockouts
        otherwise false