code: def add_text_mask(self, start, method_str, text_producer):
          def send_text(drh, rem_path):
              text = text_producer(drh, rem_path)
              if not isinstance(text, Response):
                  text = Response(text)
              ctype = text.get_ctype("text/plain")
              code = text.code
              text = text.response
              if text is None:
                  drh.send_error(404, "File not found")
                  return None
              f = BytesIO()
              if isinstance(text, (str, unicode)):
                  try:
                      text = text.decode('utf8')
                  except AttributeError:
                      pass
                  text = text.encode('utf8')
              f.write(text)
              f.flush()
              size = f.tell()
              f.seek(0)
              if drh.request_version >= "HTTP/1.1":
                  e_tag = "{0:x}".format(zlib.crc32(f.read()) & 0xFFFFFFFF)
                  f.seek(0)
                  match = _getheader(drh.headers, 'if-none-match')
                  if match is not None:
                      if drh.check_cache(e_tag, match):
                          f.close()
                          return None
                  drh.send_header("ETag", e_tag, end_header=True)
                  drh.send_header("Cache-Control",
                                  "max-age={0}".format(self.max_age),
                                  end_header=True)
              drh.send_response(code)
              drh.send_header("Content-Type", ctype)
              drh.send_header("Content-Length", size)
              drh.end_headers()
              return f
          self._add_file_mask(start, method_str, send_text)