# Buggy code
def __make_file_provider(self, dirname, filename, recurse, removeself, excludekeys):
    """Change parsed FileKey to action provider"""
    regex = ""
    if recurse:
        search = "walk.files"
        path = dirname
        if filename.startswith("*."):
            filename = filename.replace("*.", ".")
        if filename == ".*":
            if removeself:
                search = "walk.all"
        else:
            import fnmatch

            regex = ' regex="%s" ' % (fnmatch.translate(filename))
    else:
        search = "glob"
        path = os.path.join(dirname, filename)
        if path.find("*") == -1:
            search = "file"
    excludekeysxml = ""
    if excludekeys:
        if len(excludekeys) > 1:
            # multiple
            exclude_str = "(%s)" % "|".join(excludekeys)
        else:
            # just one
            exclude_str = excludekeys[0]
        excludekeysxml = 'nwholeregex="%s"' % exclude_str
    action_str = '<option command="delete" search="%s" path="%s" %s %s/>' % (
        search,
        xml_escape(path),
        regex,
        excludekeysxml,
    )
    yield Delete(parseString(action_str).childNodes[0])
    if removeself:
        action_str = '<option command="delete" search="file" path="%s"/>' % (
            xml_escape(dirname)
        )
        yield Delete(parseString(action_str).childNodes[0])


# Traceback (ExpatError)
parsing error in section Spybot Search and Destroy Updates
Traceback (most recent call last):
File "bleachbit\Winapp.pyo", line 151, in __init__
File "bleachbit\Winapp.pyo", line 285, in handle_section
File "bleachbit\Winapp.pyo", line 357, in handle_filekey
File "bleachbit\Winapp.pyo", line 329, in __make_file_provider
File "xml\dom\minidom.pyo", line 1928, in parseString
File "xml\dom\expatbuilder.pyo", line 940, in parseString
File "xml\dom\expatbuilder.pyo", line 223, in parseString
ExpatError: not well-formed (invalid token): line 1, column 222

# Fixed code
def __make_file_provider(self, dirname, filename, recurse, removeself, excludekeys):
    """Change parsed FileKey to action provider"""
    regex = ""
    if recurse:
        search = "walk.files"
        path = dirname
        if filename.startswith("*."):
            filename = filename.replace("*.", ".")
        if filename == ".*":
            if removeself:
                search = "walk.all"
        else:
            import fnmatch

            regex = ' regex="%s" ' % (fnmatch.translate(filename))
    else:
        search = "glob"
        path = os.path.join(dirname, filename)
        if path.find("*") == -1:
            search = "file"
    excludekeysxml = ""
    if excludekeys:
        if len(excludekeys) > 1:
            # multiple
            exclude_str = "(%s)" % "|".join(excludekeys)
        else:
            # just one
            exclude_str = excludekeys[0]
        excludekeysxml = 'nwholeregex="%s"' % xml_escape(exclude_str)
    action_str = '<option command="delete" search="%s" path="%s" %s %s/>' % (
        search,
        xml_escape(path),
        regex,
        excludekeysxml,
    )
    yield Delete(parseString(action_str).childNodes[0])
    if removeself:
        action_str = '<option command="delete" search="file" path="%s"/>' % (
            xml_escape(dirname)
        )
        yield Delete(parseString(action_str).childNodes[0])