<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_template(cls, message, messenger):
 """Get a template path to compile a message. 1. `tpl` field of message context; 2. `template` field of message class; 3. deduced from message, messenger data and `template_ext` message type field (e.g. `sitemessage/messages/plain__smtp.txt` for `plain` message type). :param Message message: Message model :param MessengerBase messenger: a MessengerBase heir :return: str :rtype: str """

        template = message.context.get('tpl', None)

        if template:  # Template name is taken from message context.
            return template

        if cls.template is None:
            cls.template = 'sitemessage/messages/%s__%s.%s' % (
                cls.get_alias(), messenger.get_alias(), cls.template_ext
            )
        return cls.template