Checks if a delay is needed between requests and sleeps if True

def _check_delay(self):
        """ Checks if a delay is needed between requests and sleeps if True """
        if self._previous_request_at:
            dif = round(time.time() - self._previous_request_at,
                        2) * 1000  # difference in miliseconds
            if dif < self.requests_delay:
                time.sleep(
                    (self.requests_delay - dif) / 1000)  # sleep needs seconds
        self._previous_request_at = time.time()