<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def navactive(request, url, exact=0, use_resolver=1):
 """ Returns ``active`` if the given URL is in the url path, otherwise ''. Usage:: {% load libs_tags %} <li class="{% navactive request "/news/" exact=1 %}"> :param request: A request instance. :param url: A string representing a part of the URL that needs to exist in order for this method to return ``True``. :param exact: If ``1`` then the parameter ``url`` must be equal to ``request.path``, otherwise the parameter ``url`` can just be a part of ``request.path``. :use_resolver: If ``0`` we will not try to compare ``url`` with existing view names but we will only compare it with ``request.path``. """

    if use_resolver:
        try:
            if url == resolve(request.path).url_name:
                # Checks the url pattern in case a view_name is posted
                return 'active'
            elif url == request.path:
                # Workaround to catch URLs with more than one part, which don't
                # raise a Resolver404 (e.g. '/index/info/')
                match = request.path
            else:
                return ''
        except Resolver404:
            # Indicates, that a simple url string is used (e.g. '/index/')
            match = request.path
    else:
        match = request.path

    if exact and url == match:
        return 'active'
    elif not exact and url in request.path:
        return 'active'
    return ''