def follow_url(parser, token):
    """
    Renders the URL of the follow view for a particular actor instance

    ::

        <a href="{% follow_url other_user %}">
            {% if request.user|is_following:other_user %}
                stop following
            {% else %}
                follow
            {% endif %}
        </a>

        <a href="{% follow_url other_user 'watching' %}">
            {% is_following user group "watching" as is_watching %}
            {% if is_watching %}
                stop watching
            {% else %}
                watch
            {% endif %}
        </a>
    """
    bits = token.split_contents()

    if len(bits) > 3:
        raise TemplateSyntaxError("Accepted format {% follow_url [instance] %} or {% follow_url [instance] [flag] %}")
    elif len(bits) == 2:
        return DisplayActivityFollowUrl(bits[1])
    else:
        flag = bits[2][1:-1]
        return DisplayActivityFollowUrl(bits[1], flag=flag)

    Renders the URL of the follow view for a particular actor instance

    ::

        <a href="{% follow_url other_user %}">
            {% if request.user|is_following:other_user %}
                stop following
            {% else %}
                follow
            {% endif %}
        </a>

        <a href="{% follow_url other_user 'watching' %}">
            {% is_following user group "watching" as is_watching %}
            {% if is_watching %}
                stop watching
            {% else %}
                watch
            {% endif %}
        </a>
    
actstream/templatetags/activity_tags.py