'Convert an arbitrary value into a matrix of type self.target_matrix.
Args:
value: The constant to be converted.
convert_scalars: Should scalars be converted?
Returns:
A matrix of type self.target_matrix or a scalar.'

def const_to_matrix(self, value, convert_scalars=False):

    if isinstance(value, list):
        value = numpy.atleast_2d(value)
        value = value.T
    elif scipy.sparse.issparse(value):
        value = value.A
    elif isinstance(value, numpy.matrix):
        value = value.A
    return numpy.atleast_2d(value)
