<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sample(self, sampling_period, start=None, end=None, interpolate='previous'):
 """Sampling at regular time periods. """

        start, end, mask = self._check_boundaries(start, end)

        sampling_period = \
            self._check_regularization(start, end, sampling_period)

        result = []
        current_time = start
        while current_time <= end:
            value = self.get(current_time, interpolate=interpolate)
            result.append((current_time, value))
            current_time += sampling_period
        return result