<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def compile(cls, message, messenger, dispatch=None):
 """Compiles and returns a message text. Considers `use_tpl` field from message context to decide whether template compilation is used. Otherwise a SIMPLE_TEXT_ID field from message context is used as message contents. :param Message message: model instance :param MessengerBase messenger: MessengerBase heir instance :param Dispatch dispatch: model instance to consider context from :return: str :rtype: str """

        if message.context.get('use_tpl', False):
            context = message.context
            context.update({
                'SITE_URL': get_site_url(),
                'directive_unsubscribe': cls.get_unsubscribe_directive(message, dispatch),
                'directive_mark_read': cls.get_mark_read_directive(message, dispatch),
                'message_model': message,
                'dispatch_model': dispatch
            })
            context = cls.get_template_context(context)
            return render_to_string(cls.get_template(message, messenger), context)
        return message.context[cls.SIMPLE_TEXT_ID]