# Buggy code
def GetSearchResultsVerbose(self):
    updates = []
    log.debug(
        "parsing results. {0} updates were found.".format(
            self.download_collection.count
        )
    )

    for update in self.download_collection:
        if update.InstallationBehavior.CanRequestUserInput:
            log.debug("Skipped update {0}".format(str(update)))
            continue
        # More fields can be added from https://msdn.microsoft.com/en-us/library/windows/desktop/aa386099(v=vs.85).aspx
        update_com_fields = [
            "Categories",
            "Deadline",
            "Description",
            "Identity",
            "IsMandatory",
            "KBArticleIDs",
            "MaxDownloadSize",
            "MinDownloadSize",
            "MoreInfoUrls",
            "MsrcSeverity",
            "ReleaseNotes",
            "SecurityBulletinIDs",
            "SupportUrl",
            "Title",
        ]
        simple_enums = ["KBArticleIDs", "MoreInfoUrls", "SecurityBulletinIDs"]
        # update_dict = {k: getattr(update, k) for k in update_com_fields}
        update_dict = {}
        for f in update_com_fields:
            v = getattr(update, f)
            if not any([isinstance(v, bool), isinstance(v, str)]):
                # Fields that require special evaluation.
                if f in simple_enums:
                    v = [x for x in v]
                elif f == "Categories":
                    v = [
                        {"Name": cat.Name, "Description": cat.Description} for cat in v
                    ]
                elif f == "Deadline":
                    # Deadline will be useful and should be added.
                    # However, until it can be tested with a date object
                    # as returned by the COM, it is unclear how to
                    # handle this field.
                    continue
                elif f == "Identity":
                    v = {"RevisionNumber": v.RevisionNumber, "UpdateID": v.UpdateID}
            update_dict[f] = v
        updates.append(update_dict)
        log.debug("added update {0}".format(str(update)))
    return updates


# Traceback (UnicodeEncodeError)
SERVER2008R2GUI:
The minion function caused an exception: Traceback (most recent call last):
File "C:\salt\bin\lib\site-packages\salt\minion.py", line 1039, in _thread_return
return_data = func(*args, **kwargs)
File "c:\salt\var\cache\salt\minion\extmods\modules\win_wua2.py", line 735, in install_update
return install_updates([guid])
File "c:\salt\var\cache\salt\minion\extmods\modules\win_wua2.py", line 811, in install_updates
log.debug('\tTitle: {0}'.format(update.Title))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 19: ordinal not in range(128)

# Fixed code
def GetSearchResultsVerbose(self):
    updates = []
    log.debug(
        "parsing results. {0} updates were found.".format(
            self.download_collection.count
        )
    )

    for update in self.download_collection:
        if update.InstallationBehavior.CanRequestUserInput:
            log.debug("Skipped update {0}".format(update.title))
            continue
        # More fields can be added from https://msdn.microsoft.com/en-us/library/windows/desktop/aa386099(v=vs.85).aspx
        update_com_fields = [
            "Categories",
            "Deadline",
            "Description",
            "Identity",
            "IsMandatory",
            "KBArticleIDs",
            "MaxDownloadSize",
            "MinDownloadSize",
            "MoreInfoUrls",
            "MsrcSeverity",
            "ReleaseNotes",
            "SecurityBulletinIDs",
            "SupportUrl",
            "Title",
        ]
        simple_enums = ["KBArticleIDs", "MoreInfoUrls", "SecurityBulletinIDs"]
        # update_dict = {k: getattr(update, k) for k in update_com_fields}
        update_dict = {}
        for f in update_com_fields:
            v = getattr(update, f)
            if not any([isinstance(v, bool), isinstance(v, str)]):
                # Fields that require special evaluation.
                if f in simple_enums:
                    v = [x for x in v]
                elif f == "Categories":
                    v = [
                        {"Name": cat.Name, "Description": cat.Description} for cat in v
                    ]
                elif f == "Deadline":
                    # Deadline will be useful and should be added.
                    # However, until it can be tested with a date object
                    # as returned by the COM, it is unclear how to
                    # handle this field.
                    continue
                elif f == "Identity":
                    v = {"RevisionNumber": v.RevisionNumber, "UpdateID": v.UpdateID}
            update_dict[f] = v
        updates.append(update_dict)
        log.debug("added update {0}".format(update.title))
    return updates