def run(self, func, *args, **keywords):
        "Try to run function with arguments on the creating thread."
        self.__action.put_nowait(functools.partial(func, *args, **keywords))
        if _thread.get_ident() == self.__thread:
            problem = False
            while not self.__action.empty():
                delegate = self.__action.get_nowait()
                try:
                    data = delegate()
                except Exception as error:
                    problem = error
            if problem:
                raise problem
            return data
        warnings.warn('Affinity did not return!')
Try to run function with arguments on the creating thread.
recipes/Python/577635_Directory_Pruner_3/recipe-577635.py