'Gets the context (e.g. javascript, html) of the template at the given
index.
Arguments:
contexts: A list of dicts where each dict contains the \'index\' of the context
and the context \'type\' (e.g. \'html\' or \'javascript\').
index: The index for which we want the context.
Returns:
The context (e.g. javascript or html) for the given index.'

def _get_context(self, contexts, index):

    current_context = contexts[0]['type']
    for context in contexts:
        if (context['index'] <= index):
            current_context = context['type']
        else:
            break
    return current_context
