code: def reset_epoch(func):
      
      @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
docs: Wrap a function to reset the epoch when finished
  
      This is useful for functions that wish to use `connection.set_epoch`.