Grid paths around obstacles

grid is a list of lists of 0 (open) and 1 (blocked). Write paths(grid) that returns how many routes go from the top-left to the bottom-right moving only right or down, never entering a blocked cell. If either corner is blocked the answer is 0.

paths([[0, 0, 0], [0, 1, 0], [0, 0, 0]])  ->  2
paths([[0, 1], [0, 0]])                   ->  1
paths([[1]])                              ->  0

The point is to practise a 2-D table where some cells are forced to zero.

def paths(grid):
    ...