input: 
  def solve_maze(maze: Maze) -> List[int]:
      """ Given an instance of the Maze class, return a list of integers representing the path taken to solve the maze.
      The maze is solved by finding a path from the top-left corner (start) to the bottom-right corner (end).
      The grid is a 2D list where 1 indicates a valid path and 0 indicates a wall.
      Example:
      >>> maze = Maze(5, 5)
      >>> maze._grid = [[1, 0, 1, 1, 1],
                        [1, 0, 1, 0, 1],
                        [1, 1, 1, 0, 1],
                        [0, 0, 0, 0, 1],
                        [1, 1, 1, 1, 1]]
      >>> solve_maze(maze)
      [8]
      """
      return maze.solve_maze()
  
output:     def dfs(x, y, path):
          if x == maze.rows - 1 and y == maze.cols - 1:
              return path
          for dx, dy in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
              nx, ny = x + dx, y + dy
              if 0 <= nx < maze.rows and 0 <= ny < maze.cols and maze._grid[nx][ny] == 1 and (nx, ny) not in path:
                  result = dfs(nx, ny, path + [(nx, ny)])
                  if result:
                      return result
          return None
  
      path = dfs(0, 0, [(0, 0)])
      if path:
          return [maze.get_index(x, y) for x, y in path]
      return []