#!/usr/bin/env python3
"""Early stopping"""


def early_stopping(cost, opt_cost, threshold, patience, count):
    """Early stopping"""
    if opt_cost - cost > threshold:
        count = 0
    else:
        count += 1
    return count == patience, count

0693d0eb27a047b3e2c55de255262391be3377bb
<mask token>

<mask token>


def early_stopping(cost, opt_cost, threshold, patience, count):
    """Early stopping"""
    if opt_cost - cost > threshold:
        count = 0
    else:
        count += 1
    return count == patience, count

#!/usr/bin/env python3
"""Early stopping"""


def early_stopping(cost, opt_cost, threshold, patience, count):
    """Early stopping"""
    if opt_cost - cost > threshold:
        count = 0
    else:
        count += 1
    return count == patience, count
