'Infer dimensionality from mean or covariance matrices. Handle
defaults. Ensure compatible dimensions.'

def _process_parameters(self, mean, rowcov, colcov):

    if (mean is not None):
        mean = np.asarray(mean, dtype=float)
        meanshape = mean.shape
        if (len(meanshape) != 2):
            raise ValueError('Array    `mean`    must    be    two    dimensional.')
        if np.any((meanshape == 0)):
            raise ValueError('Array    `mean`    has    invalid    shape.')
    rowcov = np.asarray(rowcov, dtype=float)
    if (rowcov.ndim == 0):
        if (mean is not None):
            rowcov = (rowcov * np.identity(meanshape[0]))
        else:
            rowcov = (rowcov * np.identity(1))
    elif (rowcov.ndim == 1):
        rowcov = np.diag(rowcov)
    rowshape = rowcov.shape
    if (len(rowshape) != 2):
        raise ValueError('`rowcov`    must    be    a    scalar    or    a    2D    array.')
    if (rowshape[0] != rowshape[1]):
        raise ValueError('Array    `rowcov`    must    be    square.')
    if (rowshape[0] == 0):
        raise ValueError('Array    `rowcov`    has    invalid    shape.')
    numrows = rowshape[0]
    colcov = np.asarray(colcov, dtype=float)
    if (colcov.ndim == 0):
        if (mean is not None):
            colcov = (colcov * np.identity(meanshape[1]))
        else:
            colcov = (colcov * np.identity(1))
    elif (colcov.ndim == 1):
        colcov = np.diag(colcov)
    colshape = colcov.shape
    if (len(colshape) != 2):
        raise ValueError('`colcov`    must    be    a    scalar    or    a    2D    array.')
    if (colshape[0] != colshape[1]):
        raise ValueError('Array    `colcov`    must    be    square.')
    if (colshape[0] == 0):
        raise ValueError('Array    `colcov`    has    invalid    shape.')
    numcols = colshape[0]
    if (mean is not None):
        if (meanshape[0] != numrows):
            raise ValueError('Arrays    `mean`    and    `rowcov`    must    have    thesame    number    of    rows.')
        if (meanshape[1] != numcols):
            raise ValueError('Arrays    `mean`    and    `colcov`    must    have    thesame    number    of    columns.')
    else:
        mean = np.zeros((numrows, numcols))
    dims = (numrows, numcols)
    return (dims, mean, rowcov, colcov)
