def METHOD_NAME(
    name,
    expected,
    compare_operator="eq",
    timeout=60,
    period=1,
    init_wait=0,
    args=None,
    kwargs=None,
):
    """
    Generic waiter state that waits for a specific salt function to produce an
    expected result.
    The state fails if the function does not exist or raises an exception,
    or does not produce the expected result within the allotted retries.
    :param str name: Name of the module.function to call
    :param expected: Expected return value. This can be almost anything.
    :param str compare_operator: Operator to use to compare the result of the
        module.function call with the expected value. This can be anything present
        in __salt__ or __utils__. Will be called with 2 args: result, expected.
    :param timeout: Abort after this amount of seconds (excluding init_wait).
    :type timeout: int or float
    :param period: Time (in seconds) to wait between attempts.
    :type period: int or float
    :param init_wait: Time (in seconds) to wait before trying anything.
    :type init_wait: int or float
    :param list args: args to pass to the salt module.function.
    :param dict kwargs: kwargs to pass to the salt module.function.
    .. versionadded:: 3000
    """
    ret = {"name": name, "comment": "", "changes": {}, "result": False}
    if name not in __salt__:
        ret["comment"] = 'Module.function "{}" is unavailable.'.format(name)
    elif not isinstance(period, (int, float)):
        ret["comment"] = "Period must be specified as a float in seconds"
    elif not isinstance(timeout, (int, float)):
        ret["comment"] = "Timeout must be specified as a float in seconds"
    elif compare_operator in __salt__:
        comparator = __salt__[compare_operator]
    elif compare_operator in __utils__:
        comparator = __utils__[compare_operator]
    elif not hasattr(operator, compare_operator):
        ret["comment"] = 'Invalid operator "{}" supplied.'.format(compare_operator)
    else:
        comparator = getattr(operator, compare_operator)
    if __opts__["test"]:
        ret["result"] = None
        ret["comment"] = 'Would have waited for "{}" to produce "{}".'.format(
            name, expected
        )
    if ret["comment"]:
        return ret
    if init_wait:
        time.sleep(init_wait)
    if args is None:
        args = []
    if kwargs is None:
        kwargs = {}
    res_archive = []
    current_attempt = 0
    timeout = time.time() + timeout
    while time.time() < timeout:
        current_attempt += 1
        try:
            res = __salt__[name](*args, **kwargs)
        except Exception:  # pylint: disable=broad-except
            (exc_type, exc_value, _) = sys.exc_info()
            ret["comment"] = "Exception occurred while executing {}: {}:{}".format(
                name, exc_type, exc_value
            )
            break
        res_archive.append(res)
        cmp_res = comparator(res, expected)
        log.debug(
            "%s:until_no_eval:\n"
            "\t\tAttempt %s, result: %s, expected: %s, compare result: %s",
            __name__,
            current_attempt,
            res,
            expected,
            cmp_res,
        )
        if cmp_res:
            ret["result"] = True
            ret["comment"] = "Call provided the expected results in {} attempts".format(
                current_attempt
            )
            break
        time.sleep(period)
    else:
        ret[
            "comment"
        ] = "Call did not produce the expected result after {} attempts".format(
            current_attempt
        )
        log.debug(
            "%s:until_no_eval:\n\t\tResults of all attempts: %s",
            __name__,
            res_archive,
        )
    return ret