'Returns a messages file name components
Receives the file name (without path) of a msg.  Usual format is
\'<%d_%d.%d.%s>,U=<%d>,FMD5=<%s>:2,<FLAGS>\' (pointy brackets
denoting the various components).
If FMD5 does not correspond with the current folder MD5, we will
return None for the UID & FMD5 (as it is not valid in this
folder).  If UID or FMD5 can not be detected, we return `None`
for the respective element.  If flags are empty or cannot be
detected, we return an empty flags list.
:returns: (prefix, UID, FMD5, flags). UID is a numeric "long"
type. flags is a set() of Maildir flags.'

def _parse_filename(self, filename):

    (prefix, uid, fmd5, flags) = (None, None, None, set())
    prefixmatch = self.re_prefixmatch.match(filename)
    if prefixmatch:
        prefix = prefixmatch.group(1)
    folderstr = (',FMD5=%s' % self._foldermd5)
    foldermatch = (folderstr in filename)
    if foldermatch:
        uidmatch = re_uidmatch.search(filename)
        if uidmatch:
            uid = int(uidmatch.group(1))
    flagmatch = self.re_flagmatch.search(filename)
    if flagmatch:
        flags = set((c for c in flagmatch.group(1)))
    return (prefix, uid, fmd5, flags)
