'Load the kextmanager, replacing unavailable symbols.'

def SafeLoadKextManager(self, fn_table):

    dll = None
    try:
        dll = SetCTypesForLibrary('IOKit', fn_table)
    except AttributeError as ae:
        if ('KextManagerUnloadKextWithIdentifier' in str(ae)):
            logging.debug('Using    legacy    kextunload')
            dll = self.SafeLoadKextManager(FilterFnTable(fn_table, 'KextManagerUnloadKextWithIdentifier'))
            dll.KextManagerUnloadKextWithIdentifier = self.LegacyKextunload
        elif ('KextManagerLoadKextWithURL' in str(ae)):
            logging.debug('Using    legacy    kextload')
            dll = self.SafeLoadKextManager(FilterFnTable(fn_table, 'KextManagerLoadKextWithURL'))
            dll.KextManagerLoadKextWithURL = self.LegacyKextload
        else:
            raise OSError("Can't    resolve    KextManager    symbols:{0}".format(str(ae)))
    return dll
