def rate(wait=MIN_WAIT, reps=REPS):
    """ Rate limit a command function.

    :param wait: How long to wait between commands.
    :param reps: How many times to send a command.
    :returns: Decorator.
    """
    def decorator(function):
        """ Decorator function.

        :returns: Wrapper.
        """
        def wrapper(self, *args, **kwargs):
            """ Wrapper.

            :param args: Passthrough positional arguments.
            :param kwargs: Passthrough keyword arguments.
            """
            saved_wait = self.wait
            saved_reps = self.reps
            self.wait = wait
            self.reps = reps
            function(self, *args, **kwargs)
            self.wait = saved_wait
            self.reps = saved_reps
        return wrapper
    return decorator
Rate limit a command function.

    :param wait: How long to wait between commands.
    :param reps: How many times to send a command.
    :returns: Decorator.