Render the template with a given context. Here we're adding
        some context variables that are required for all templates in
        the system like the statix url and the CSRF tokens, etc.

        :param context: It must be a dict if provided
        :param request: It must be a django.http.HttpRequest if provided
        :return: A rendered template

def render(self, context=None, request=None):
        """
        Render the template with a given context. Here we're adding
        some context variables that are required for all templates in
        the system like the statix url and the CSRF tokens, etc.

        :param context: It must be a dict if provided
        :param request: It must be a django.http.HttpRequest if provided
        :return: A rendered template
        """
        if context is None:
            context = {}

        context['static'] = static
        context['url'] = self.get_reverse_url()

        if request is not None:
            # As Django doesn't have a global request object,
            # it's useful to put it in the context.
            context['request'] = request
            # Passing the CSRF token is mandatory.
            context['csrf_input'] = csrf_input_lazy(request)
            context['csrf_token'] = csrf_token_lazy(request)

        try:
            return self.template.render(**context)
        except Exception as e:
            traceback = RichTraceback()

            source = traceback.source
            if not source:
                # There's no template source lines then raise
                raise e

            source = source.split('\n')
            line = traceback.lineno
            top = max(0, line - 4)
            bottom = min(len(source), line + 5)
            source_lines = [(i + 1, source[i]) for i in range(top, bottom)]

            e.template_debug = {
                'name': traceback.records[5][4],
                'message': '{}: {}'.format(
                    traceback.errorname, traceback.message),
                'source_lines': source_lines,
                'line': line,
                'during': source_lines[line - top - 1][1],
                'total': bottom - top,
                'bottom': bottom,
                'top': top + 1,
                # mako's RichTraceback doesn't return column number
                'before': '',
                'after': '',
            }

            raise e