def range(tokens):
    """``range`` descriptor validation."""
    if len(tokens) == 1:
        keyword = get_single_keyword(tokens)
        if keyword == 'auto':
            return 'auto'
    elif len(tokens) == 2:
        values = []
        for i, token in enumerate(tokens):
            if token.type == 'ident' and token.value == 'infinite':
                values.append(inf if i else -inf)
            elif token.type == 'number' and token.is_integer:
                values.append(token.int_value)
        if len(values) == 2 and values[0] <= values[1]:
            return tuple(values)
``range`` descriptor validation.
weasyprint/css/validation/descriptors.py