def get_url(token, base_url):
    """Parse an <url> token."""
    if token.type == 'url':
        return _get_url_tuple(token.value, base_url)
    elif token.type == 'function':
        if token.name == 'attr':
            return check_attr_function(token, 'url')
        elif token.name == 'url' and len(token.arguments) in (1, 2):
            # Ignore url modifiers
            # See https://drafts.csswg.org/css-values-3/#urls
            return _get_url_tuple(token.arguments[0].value, base_url)
Parse an <url> token.
weasyprint/css/utils.py