def enumerate_joint(vars, e, P):
if not vars:<EOL><INDENT>return P[e]<EOL><DEDENT>Y, rest = vars[<NUM_LIT:0>], vars[<NUM_LIT:1>:]<EOL>return sum([enumerate_joint(rest, extend(e, Y, y), P)<EOL>for y in P.values(Y)])<EOL>
Return the sum of those entries in P consistent with e,
    provided vars is P's remaining variables (the ones not in e).