def assert_nonnegative_int(name: str, value: str) -> int:
    """
    Makes sure the value is a non-negative integer, otherwise raises AssertionError

    :param name: Argument name
    :param value: Value
    :return: Value as integer
    """
    if not (value.isdigit() and int(value) >= 0):
        raise AssertionError(
            "Expected a non-negative integer for {}, but got `{}`".format(name, value))

    return int(value)