<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rate_limited(max_per_second):
 """ Sort of based off of an answer about rate limiting on Stack Overflow. Definitely **not** thread safe, so don't even think about it, buddy. """

    import datetime
    min_request_time = datetime.timedelta(seconds=max_per_second)
    last_time_called = [None]
    def decorate(func):
        def rate_limited_function(*args, **kwargs):
            if last_time_called[0]:
                delta = datetime.datetime.now() - last_time_called[0]
                if delta < datetime.timedelta.min:
                    raise chrw.exceptions.TimeIsBackToFront, "Call the Doc!"
                elif delta < min_request_time:
                    msg = "Last request was {0}, should be at least {1}".format(
                        delta, min_request_time
                    )
                    raise chrw.exceptions.RequestRateTooHigh, msg
            ret = func(*args, **kwargs)
            last_time_called[0] = datetime.datetime.now()
            return ret
        return functools.update_wrapper(rate_limited_function, func)
    return decorate