input: 
  from typing import List, Union
  
  def add_matrix(matrix1: List[List[int]], matrix2: List[List[int]]) -> Union[str, List[List[int]]]:
      """ Adds two matrices if they are of the same dimensions. Otherwise, returns an error message.
      
      >>> add_matrix([[1, 2], [3, 4]], [[2, 3], [4, 5]])
      [[3, 5], [7, 9]]
      
      >>> add_matrix([[1, 2]], [[3, 4], [5, 6]])
      'Matrices not compatible'
      """
      if not matrix1 or not matrix2 or len(matrix1) != len(matrix2) or len(matrix1[0]) != len(matrix2[0]):
          return 'Matrices not compatible'
      
      return [[matrix1[i][j] + matrix2[i][j] for j in range(len(matrix1[0]))] for i in range(len(matrix1))]
  
output:     if not matrix1 or not matrix2 or len(matrix1) != len(matrix2) or len(matrix1[0]) != len(matrix2[0]):
          return 'Matrices not compatible'
      
      return [[matrix1[i][j] + matrix2[i][j] for j in range(len(matrix1[0]))] for i in range(len(matrix1))]