def METHOD_NAME(m):
    prefix = m.group(2) or ''
    url = m.group(3)
    if url.startswith('/event/') or re.match(r'https?:', prefix):
        rewritten_url, image_file = _rewrite_event_asset_url(event, prefix + url)
        if image_file:
            used_images.add(image_file)
        return f'url({rewritten_url})'
    else:
        rewritten_url = rewrite_static_url(url)
        used_urls.add(_remove_anchor(rewritten_url))
        if url.startswith('/static/plugins/'):
            return f"url('../../../../../{rewritten_url}')"
        else:
            return f"url('../../../{rewritten_url}')"