def evaluate_node(G, query, val, conditions):
    """
    Evaluate probability P(query = val | conditions) given Bayesian Network.
    
    Parameters
    ----------
    G : Network (see network.py)
       The Bayesian network to base evaluation on.
    query : int
       Feature index.
    val : int
       Truth value: 0 or 1.
    conditions : dict of {int : int}
       Features describing the conditional part.
       Key is the feature index, and value is a truth value: 0 or 1.
    
    Returns
    -------
    float in [0,1]
       The probability P(query = val | conditions)
    """
    return G.get_node_probability(query, conditions) if val == 1 else 1 - G.get_node_probability(query, conditions)