<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def story_archive(request, slug, template_name='staffmembers/story_archive.html'):
 """ Return the list of stories written by this staff member """

    member = get_object_or_404(StaffMember, slug__iexact=slug, is_active=True)

    stories = []
    if hasattr(member, 'story_set'):
        from story.settings import PUBLISHED_STATUS
        stories = member.story_set.filter(publish_date__lte=datetime.now()
            ).filter(status__exact=PUBLISHED_STATUS
            ).order_by('-publish_date')

    return render_to_response(template_name,
                              {'member': member,
                               'stories': stories},
                              context_instance=RequestContext(request))