def asserts(input_value, rule, message=''):
    """ this function allows you to write asserts in generators since there are
        moments where you actually want the program to halt when certain values
        are seen.
    """
    assert callable(rule) or type(rule)==bool, 'asserts needs rule to be a callable function or a test boolean'
    assert isinstance(message, str), 'asserts needs message to be a string'
    # if the message is empty and rule is callable, fill message with rule's source code
    if len(message)==0 and callable(rule):
        try:
            s = getsource(rule).splitlines()[0].strip()
        except:
            s = repr(rule).strip()
        message = 'illegal input of {} breaks - {}'.format(input_value, s)
    if callable(rule):
        # if rule is a function, run the function and assign it to rule
        rule = rule(input_value)
    # now, assert the rule and return the input value
    assert rule, message
    return input_value
this function allows you to write asserts in generators since there are
        moments where you actually want the program to halt when certain values
        are seen.