<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _is_nan(self, variable: str, data) -> bool: """ Recursively search passed data and find NaNs. :param variable: name of variable to be checked :param data: data object (dict, list, scalar) :return: `True` if there is a NaN value in the data; `False` otherwise. :raise ValueError: if the variable value is of unsupported type and ``on_unknown_type`` is set to ``error`` """

        if isinstance(data, np.ndarray) or isinstance(data, list):
            return any(np.isnan(data)) or (self._stop_on_inf and any(np.isinf(data)))
        elif np.isscalar(data):
            return np.isnan(data) or (self._stop_on_inf and np.isinf(data))
        elif isinstance(data, dict):
            return any([self._is_nan(key, value) for key, value in data.items()])
        else:
            message = 'Variable `{}` of type `{}` can not be checked for NaNs.'.format(variable, type(data))
            if self._on_unkown_type == 'warn':
                logging.warning(message)
            elif self._on_unkown_type == 'error':
                raise ValueError(message)
            return False