def _check_shape_matadd(mat):
    """
        Determines matrix shape of given matrix (as defined in matmul) 'mat'
    
        Args:
            mat - A list/list of lists representing a vector/matrix (see 'matmul')
    
        Returns:
            m, n - The shape of mat
    """
    
    if isinstance(mat[0],list):
        m = len(mat)
        n = len(mat[0])
    else:
        m = 0
        n = len(mat)
    
    return m, n