input: Write a python function to check if a given Sudoku board is valid.
  assert is_valid_sudoku([
    [7,8,5,4,3,9,1,2,6],
    [6,1,2,8,7,5,3,4,9],
    [4,9,3,6,2,1,5,7,8],
    [8,5,7,9,4,3,2,6,1],
    [2,6,1,7,5,8,9,3,4],
    [9,3,4,1,6,2,7,8,5],
    [5,7,6,3,9,4,8,1,2],
    [1,2,8,5,8,7,4,9,6],
    [3,4,9,2,1,6,5,7,7]
  ]) == False
  assert is_valid_sudoku([
    [5,3,4,6,7,8,9,1,2],
    [6,7,2,1,9,5,3,4,8],
    [1,9,8,3,4,2,5,6,7],
    [8,5,9,7,6,1,4,2,3],
    [4,2,6,8,5,3,7,9,1],
    [7,1,3,9,2,4,8,5,6],
    [9,6,1,5,3,7,2,8,4],
    [2,8,7,4,1,9,6,3,5],
    [3,4,5,2,8,6,1,7,9]
  ]) == True
output: def is_valid_sudoku(board):
      def is_valid_block(block):
          block = [num for num in block if num != 0]
          return len(block) == len(set(block))
      
      def get_block(board, row, col):
          return [board[r][c] for r in range(row, row + 3) for c in range(col, col + 3)]
      
      for i in range(9):
          if not is_valid_block(board[i]):  # Check rows
              return False
          if not is_valid_block([board[r][i] for r in range(9)]):  # Check columns
              return False
  
      for i in range(0, 9, 3):
          for j in range(0, 9, 3):
              if not is_valid_block(get_block(board, i, j)):  # Check 3x3 subgrids
                  return False
  
      return True