'Makes sure that we don\'t send more than X HTTP requests per seconds
:return:'

def _rate_limit(self):

    max_requests_per_second = self.settings.get_max_requests_per_second()
    if (max_requests_per_second > 0):
        min_interval = (1.0 / float(max_requests_per_second))
        elapsed = (time.clock() - self._rate_limit_last_time_called)
        left_to_wait = (min_interval - elapsed)
        with self._rate_limit_lock:
            if (left_to_wait > 0):
                time.sleep(left_to_wait)
        self._rate_limit_last_time_called = time.clock()
