<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def render_pictures(context, selection='recent', amount=3):
 """Template tag to render a list of pictures."""

    pictures = Image.objects.filter(
        folder__id__in=Gallery.objects.filter(is_published=True).values_list(
            'folder__pk', flat=True))
    if selection == 'recent':
        context.update({
            'pictures': pictures.order_by('-uploaded_at')[:amount]
        })
    elif selection == 'random':
        context.update({
            'pictures': pictures.order_by('?')[:amount]
        })
    else:
        return None
    return context