def METHOD_NAME(max_times: int = 3, error_types: Tuple[Type] = (Exception,)):
    """
    Decorator to repeat a command if it fails with an error
    :param times: The maximum number of times to repeat the command
    :param error_types: The types of errors to catch
    """
    def decorator(func):
        @wraps(func)
        def inner(*args, **kwargs):
            for _ in range(max_times - 1):
                try:
                    return func(*args, **kwargs)
                except error_types as err:
                    logger.debug(f"Retrying due to error: {err}")
            # Allow the exception on the last try to bubble up
            return func(*args, **kwargs)
        return inner
    return decorator