def _check_shape_matmul(mat, order):
    """
        Checks size of 'mat' and reshapes if necessary.
    
        Args:
            mat - A list/list of lists representing a vector/matrix (see 'matmul')
            order - Indicates whether mat is a left/right matrix/vector such that
                    we can broadcast appropriately.
    
        Returns:
            (m,n) - Tuple giving the shape of mat
            broadcast - Boolean indicating whether we should broadcast list
    """
    
    broadcast_list = False
    if isinstance(mat[0],list):
        m = len(mat)
        n = len(mat[0])
    elif order == 'left':
        m = 1
        n = len(mat)
        broadcast_list = True
    else:  # order == 'right'
        m = len(mat)
        n = 1
        broadcast_list = True
    
    return m, n, broadcast_list