docs: def rate_limited(max_per_hour: int, *args: Any) -> Callable[..., Any]:
      """Decorator to limit function to N calls/hour."""
      min_interval = 3600.0 / float(max_per_hour)
  
      def _decorate(func: Callable[..., Any]) -> Callable[..., Any]:
          things = [func.__name__]
          things.extend(args)
          key = "".join(things)
          LOG.debug(f"Rate limiter called for '{key}'.")
          if key not in LAST_CALLED:
              LOG.debug(f"Initializing entry for '{key}'.")
              LAST_CALLED[key] = 0.0
  
          def _rate_limited_function(*args: Any, **kargs: Any) -> Any:
              last_called = LAST_CALLED[key]
              now = time.time()
              elapsed = now - last_called
              remaining = min_interval - elapsed
              LOG.debug(f"Rate limiter last called for '{key}' at {last_called}.")
              LOG.debug(f"Remaining cooldown time for '{key}' is {remaining}.")
  
              if remaining > 0 and last_called > 0.0:
                  LOG.info(f"Self-enforced rate limit hit, sleeping {remaining} seconds.")
                  for i in tui.progress.bar(range(math.ceil(remaining))):
                      time.sleep(1)
  
              LAST_CALLED[key] = time.time()
              ret = func(*args, **kargs)
              LOG.debug(f"Updating rate limiter last called for '{key}' to {now}.")
              return ret
  
          return _rate_limited_function
      return _decorate