def wrapped_f(self, f, *args, **kwargs):
        now = datetime.datetime.now()
        # At the first call, reset the time
        if self.__last_call == None:
            self.__last_call = now
            return f(*args, **kwargs)

        time_delta = now - self.__last_call
        try:
            time_delta = int(time_delta.total_seconds()) + 1
        except __HOLE__:
            time_delta = int((time_delta.microseconds + (time_delta.seconds + time_delta.days * 24 * 3600) * 10**6) / 10**6)

        assert time_delta >= 0
        if time_delta <= self.__time_interval:
            to_sleep = self.__time_interval - time_delta
            # print "To sleep", to_sleep
            time.sleep(to_sleep)

        self.__last_call = datetime.datetime.now()
        return f(*args, **kwargs)
dataset/ETHPy150Open themiurgo/ratelim/ratelim/__init__.py/patient.wrapped_f