docs: def transform(self, rules, theme_template, is_html5, context_data=None):
          """Method used to make a transformation on the content of
          the http response based on the rules and theme_templates
          passed as paremters
  
          :param  rules: A file with a set of diazo rules to make a
                         transformation over the original response content
          :param  theme_template: A file containing the template used to format
                                  the the original response content
          :param    is_html5: A boolean parameter to identify a html5 doctype
          :returns: A response with a content transformed based on the rules and
                    theme_template
          """
  
          if not self.should_transform():
              self.log.info("Don't need to be transformed")
              return self.response
  
          theme = loader.render_to_string(theme_template, context=context_data,
                                          request=self.request)
          output_xslt = compile_theme(
              rules=rules,
              theme=StringIO(theme),
          )
  
          transform = etree.XSLT(output_xslt)
          self.log.debug("Transform: %s", transform)
  
          charset = get_charset(self.response.get('Content-Type'))
  
          try:
              decoded_response = self.response.content.decode(charset)
          except UnicodeDecodeError:
              decoded_response = self.response.content.decode(charset, 'ignore')
              self.log.warning("Charset is {} and type of encode used in file is\
                                different. Some unknown characteres might be\
                                ignored.".format(charset))
  
          content_doc = etree.fromstring(decoded_response,
                                         parser=etree.HTMLParser())
  
          self.response.content = transform(content_doc)
  
          if is_html5:
              self.set_html5_doctype()
  
          self.reset_headers()
  
          self.log.debug("Response transformer: %s", self.response)
          return self.response