def convert_inputs_to_sparse_if_necessary(lhs, rhs):
    '''
    This function checks to see if a sparse output is desireable given the inputs and if so, casts the inputs to sparse in order to make it so.
    '''
    if not sp.issparse(lhs) or not sp.issparse(rhs):
        if sparse_is_desireable(lhs, rhs):
            if not sp.issparse(lhs):
                lhs = sp.csc_matrix(lhs)
                #print "converting lhs into sparse matrix"
            if not sp.issparse(rhs):
                rhs = sp.csc_matrix(rhs)
                #print "converting rhs into sparse matrix"
    return lhs, rhs
This function checks to see if a sparse output is desireable given the inputs and if so, casts the inputs to sparse in order to make it so.