def page_is_active(context, page, feincms_page=None, path=None):
    """
    Usage example::

        {% feincms_nav feincms_page level=1 as toplevel %}
        <ul>
        {% for page in toplevel %}
            {% page_is_active page as is_active %}
            <li {% if is_active %}class="active"{% endif %}>
                <a href="{{ page.get_navigation_url }}">{{ page.title }}</a>
            <li>
        {% endfor %}
        </ul>
    """
    if isinstance(page, PagePretender):
        if path is None:
            path = context["request"].path_info
        return path.startswith(page.get_absolute_url())

    else:
        if feincms_page is None:
            feincms_page = context["feincms_page"]
        return page.is_ancestor_of(feincms_page, include_self=True)

    Usage example::

        {% feincms_nav feincms_page level=1 as toplevel %}
        <ul>
        {% for page in toplevel %}
            {% page_is_active page as is_active %}
            <li {% if is_active %}class="active"{% endif %}>
                <a href="{{ page.get_navigation_url }}">{{ page.title }}</a>
            <li>
        {% endfor %}
        </ul>
    
feincms/templatetags/feincms_page_tags.py