code: def _is_2D_matrix(matrix):
      
      return ((isinstance(matrix[0], list) and _rectangular(matrix) and
               not isinstance(matrix[0][0], list)) or
              (not isinstance(matrix, list) and matrix.shape == 2))
docs: Checks to see if a ndarray is 2D or a list of lists is 2D