def get_question_title(context, question_id):
    """Return the value that should be used as the title to a question
    May be from question.title or question_titles in the context"""
    context = context.parent
    question = context['question']

    if question_id == question['id']:
        if question.get('title') is not None:
            return question['title']
        question_title = context['content']['question_titles']
        return question_title[question_id]