input: from typing import List, Union
  
  def generate_output(n: int) -> List[List[Union[str, None]]]:
      """Generate a 2D list of characters that represent a pattern of '#' and ' ' 
      based on the sum of indices modulo 2. The function should take an integer n 
      as input and generate an n x n pattern.
      
      >>> generate_output(7)
      [['#', ' ', '#', ' ', '#', ' ', '#'],
       [' ', '#', ' ', '#', ' ', '#', ' '],
       ['#', ' ', '#', ' ', '#', ' ', '#'],
       [' ', '#', ' ', '#', ' ', '#', ' '],
       ['#', ' ', '#', ' ', '#', ' ', '#'],
       [' ', '#', ' ', '#', ' ', '#', ' '],
       ['#', ' ', '#', ' ', '#', ' ', '#']]
      """
      output = []
      for i in range(n):
          row = []
          for j in range(n):
              if (i + j) % 2 == 0:
                  row.append('#')
              else:
                  row.append(' ')
          output.append(row)
      return output
output:     output = []
      for i in range(n):
          row = []
          for j in range(n):
              if (i + j) % 2 == 0:
                  row.append('#')
              else:
                  row.append(' ')
          output.append(row)
      return output