Display any available live chats as advertisements.

def live_chat_banner(context):
    """ Display any available live chats as advertisements.
    """
    context = copy(context)

    # Find any upcoming or current live chat. The Chat date must be less than 5
    # days away, or currently in progress.

    oldchat = LiveChat.chat_finder.get_last_live_chat()

    if oldchat:
        context['last_live_chat'] = {
            'title': oldchat.title,
            'chat_ends_at': oldchat.chat_ends_at,
            'expert': oldchat.expert,
            'url': reverse('livechat:show_archived_livechat')

        }

    chat = LiveChat.chat_finder.upcoming_live_chat()
    if chat is not None:
        context['live_chat_advert'] = {
            'title': chat.title,
            'description': chat.description,
            'expert': chat.expert,
            'commenting_closed': chat.comments_closed,
            'cancelled': chat.is_cancelled,
            'archived': chat.is_archived,
            'in_progress': chat.is_in_progress(),
            'url':  reverse(
                'livechat:show_livechat',
                kwargs={
                    'slug': chat.slug}),
            'archive_url':reverse('livechat:show_archived_livechat')

        }
        context['live_chat_advert']['datetime'] = {
            'time': chat.chat_starts_at.time,
            'date': chat.chat_starts_at.date
            }
    return context