def __slice_scov__(cov, dep, given):
    """
    Slices a covariance matrix keeping only the covariances between the variables
    indicated by the array of indices of the independent variables.
    :param cov: Covariance matrix.
    :param dep: Index of dependent variable.
    :param given: Array of indices of independent variables.
    :return: A |given| x |given| matrix of covariance.
    """
    row_selector = [x for x in range(cov.shape[0]) if x in given and x != dep]
    col_selector = [x for x in range(cov.shape[1]) if x in given and x != dep]
    v = cov[row_selector, :]
    v = v[:, col_selector]
    return v