def os_national_grid_to_coords(grid_position):
    """Convert a OS national grid reference like `SE 29383 34363` to
    coordinates, e.g. `(429383, 434363)`."""
    try:
        code, x, y = grid_position.split(' ')
        x, y = int(x), int(y)
        codes = 'ABCDEFGHJKLMNOPQRSTUVWXYZ'
        index0 = codes.index(code[0])
        x500, y500 = index0 % 5 - 2, 3 - index0 // 5
        index1 = codes.index(code[1])
        x100, y100 = index1 % 5, 4 - index1 // 5
        return (500000 * x500 + 100000 * x100 + x, 500000 * y500 + 100000 *
            y100 + y)
    except:
        raise ValueError("Should be a grid reference like 'SE 12345 12345'.")
