<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):
 """ Compute new samples. """

        self._sampling = True

        try:
            if self.is_raw_perf_class and not self._previous_sample:
                self._current_sample = self._query()

            self._previous_sample = self._current_sample
            self._current_sample = self._query()
        except TimeoutException:
            self.logger.debug(u"Query timeout after {timeout}s".format(timeout=self._timeout_duration))
            raise
        else:
            self._sampling = False