<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def reset_epoch(func):
 """Wrap a function to reset the epoch when finished This is useful for functions that wish to use `connection.set_epoch`. """

    @wraps(func)
    def wrapped_func(*args, **kwargs):  # pylint: disable=missing-docstring
        connection = kwargs.get('connection', None)
        epoch = connection.current_epoch() if connection else None
        try:
            return func(*args, **kwargs)
        finally:
            if epoch is not None:
                connection.set_epoch(epoch.gps_start, epoch.gps_stop)
    return wrapped_func