Determine if the given filename indicates a dense or a sparse matrix

       If pathname is xxx.coo.yyy return True otherwise False.

def is_sparse_file(filename):
    """Determine if the given filename indicates a dense or a sparse matrix

       If pathname is xxx.coo.yyy return True otherwise False.

    """
    dirname, basename = os.path.split(filename)
    name, ext = os.path.splitext(basename)
    matrix_name, matrix_ext = os.path.splitext(name)
    if matrix_ext == '.coo':
        return True
    else:
        return False