def recursive_targets(target_list, target_key):
    for target in target_list:
        if target_key in getattr(target, 'target_keys', ()):
            yield target
        for sub_target in recursive_targets(getattr(target, 'target_providers', ()), target_key):
            yield sub_target
dataset/ETHPy150Open genzgd/Lampost-Mud/lampost/gameops/target_gen.py/recursive_targets/original