human
I wrote the below code

    from .assertions import eq_, emits_warning
    canary = []
    orig_warn = util.warn
    def capture_warnings(*args, **kw):
        orig_warn(*args, **kw)
        popwarn = warnings.pop(0)
        canary.append(popwarn)
        if regex:
            assert re.match(popwarn, args[0])
        else:
            eq_(args[0], popwarn)
    util.warn = util.langhelpers.warn = capture_warnings
    result = emits_warning()(fn)()
    assert canary, 'No    warning    was    emitted'
    return result

What's a good function header?
 ... Here's a good function header?
assistant
#Here's a good function header.

def assert_warnings(fn, warnings, regex=False):