code: def _filter(msgdata, mailparser, mdfolder, mailfilters):
      
      if mailfilters:
          for f in mailfilters:
              msg = mailparser.parse(StringIO(msgdata))
              rule = f(msg, folder=mdfolder)
              if rule:
                  yield rule
      return
docs: Filter msgdata by mailfilters