human
I wrote the below code

    def next():
        while True:
            try:
                return it.next()
            except StopIteration:
                raise
            except:
                traceback.print_exc()
    it = iter(it)
    while True:
        (yield next())

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

def safeiter(it, cleanup=None, ignore_errors=True):