def isoforest_label_adjust(pred_func):
    """Adjusts isolation forest predictions to be 1 for outliers, 0 for inliers.

    By default the scikit-learn isolation forest returns -1 for outliers and 1
    for inliers, so this method is used to wrap fit_predict or predict methods
    and return 0 for inliers, 1 for outliers.

    :param pred_func: Scikit-learn prediction function that returns a flat
        :class:`numpy.ndarray` of labels ``-1`` and ``1``.
    :type pred_func: function or method
    :rtype: function
    """
    def adjust_pred_func(*args, **kwargs):
        res = pred_func(*args, **kwargs)
        res[res == -1] = 1
        res[res == 1] = 0
        return res

    return adjust_pred_func