def draw_line(a1, a2, b, out_grid, colour, vert):
    """
        Helper function for solve_5c2c9af4, used by draw_concentric_squares
        It draws a horizontal line between two columns with the row specified in a 2d array

        For an effectively vertical line, transpose array to draw in horizontal direction then transpose back to get vertical line
    """
    if vert: # vertical line
        out_grid = out_grid.T
        for i in range(a1, a2+1):
            out_grid[b][i] = colour
        out_grid = out_grid.T
    else: # horizontal line
        for i in range(a1, a2+1):
            out_grid[b][i] = colour
    return out_grid