def activity_stream(context, stream_type, *args, **kwargs):
    """
    Renders an activity stream as a list into the template's context.
    Streams loaded by stream_type can be the default ones (eg user, actor, etc.) or a user defined stream.
    Extra args/kwargs are passed into the stream call.

    ::

        {% activity_stream 'actor' user %}
        {% for action in stream %}
            {% display_action action %}
        {% endfor %}
    """
    if stream_type == 'model':
        stream_type = 'model_actions'
    if not hasattr(Action.objects, stream_type):
        raise TemplateSyntaxError('Action manager has no attribute: %s' % stream_type)
    ctxvar = kwargs.pop('as', 'stream')
    context[ctxvar] = getattr(Action.objects, stream_type)(*args, **kwargs)
    return ''

    Renders an activity stream as a list into the template's context.
    Streams loaded by stream_type can be the default ones (eg user, actor, etc.) or a user defined stream.
    Extra args/kwargs are passed into the stream call.

    ::

        {% activity_stream 'actor' user %}
        {% for action in stream %}
            {% display_action action %}
        {% endfor %}
    
actstream/templatetags/activity_tags.py