code: def add_filter(self, ftype, func):
          ''' Register a new output filter. Whenever bottle hits a handler output
              matching `ftype`, `func` is applyed to it. '''
          if not isinstance(ftype, type):
              raise TypeError("Expected type object, got %s" % type(ftype))
          self.castfilter = [(t, f) for (t, f) in self.castfilter if t != ftype]
          self.castfilter.append((ftype, func))
          self.castfilter.sort(f add_filter(self, ftype, func):
          ''' Register a new output filter. Whenever bottle hits a handler output
              matching `ftype`, `func` is applyed to it. '''
          if not isinstance(ftype, type):
              raise TypeError("Expected type object, got %s" % type(ftype))
          self.castfilter = [(t, f) for (t, f) in self.castfilter if t != ftype]
          self.castfilter.append((ftype, func))
          self.castfilter.sort()
docs: Register a new output filter. Whenever bottle hits a handler output
              matching `ftype`, `func` is applyed to it.