input: Write a function to generate a pattern of '#' and spaces where '#' appears at positions where the sum of the row index and column index is even, and spaces appear otherwise. The function should print this pattern for a 7x7 grid. If the input is not applicable, the function should also handle it appropriately.
  assert generate_pattern()=="""#######
         #######
         #######
         #######
         """
  assert generate_pattern("invalid")=="""#######
         #######
         #######
         #######
         """
output: def generate_pattern(input=None):
      grid = ""
      for i in range(7):
          for j in range(7):
              if (i + j) % 2 == 0:
                  grid += "#"
              else:
                  grid += " "
          grid += "\n"
      return grid