def max_width_height(token):
    """Validation for max-width and max-height"""
    length = get_length(token, negative=False, percentage=True)
    if length:
        return length
    if get_keyword(token) == 'none':
        return Dimension(inf, 'px')
Validation for max-width and max-height
weasyprint/css/validation/properties.py