# Buggy code
def restore_from_backup(self, target_host, source_path):
    playbook = "deploy/ansible/worker/restore_ursula_from_backup.yml"

    self.generate_ansible_inventory([target_host], restore_path=source_path)

    loader = DataLoader()
    inventory = InventoryManager(loader=loader, sources=self.inventory_path)
    callback = AnsiblePlayBookResultsCollector(
        sock=self.emitter, return_results=self.output_capture
    )
    variable_manager = VariableManager(loader=loader, inventory=inventory)

    executor = PlaybookExecutor(
        playbooks=[playbook],
        inventory=inventory,
        variable_manager=variable_manager,
        loader=loader,
        passwords=dict(),
    )
    executor._tqm._stdout_callback = callback
    executor.run()
    self.give_helpful_hints([target_host], backup=True, playbook=playbook)


# Traceback (TypeError)
Traceback (most recent call last):
File "/home/k/.local/share/virtualenvs/nucypher-iNjwDRsw/bin/nucypher", line 33, in <module>
sys.exit(load_entry_point('nucypher', 'console_scripts', 'nucypher')())
File "/home/k/.local/share/virtualenvs/nucypher-iNjwDRsw/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/k/.local/share/virtualenvs/nucypher-iNjwDRsw/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/k/.local/share/virtualenvs/nucypher-iNjwDRsw/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/k/.local/share/virtualenvs/nucypher-iNjwDRsw/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/k/.local/share/virtualenvs/nucypher-iNjwDRsw/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/k/.local/share/virtualenvs/nucypher-iNjwDRsw/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/k/Git/nucypher/nucypher/cli/options.py", line 167, in wrapper
return func(**kwargs)
File "/home/k/Git/nucypher/nucypher/cli/options.py", line 167, in wrapper
return func(**kwargs)
File "/home/k/Git/nucypher/nucypher/cli/options.py", line 167, in wrapper
return func(**kwargs)
TypeError: add_for_stake() got an unexpected keyword argument 'config_file'

# Fixed code
def restore_from_backup(self, target_host, source_path):
    playbook = Path(DEPLOY_DIR).joinpath(
        "ansible/worker/restore_ursula_from_backup.yml"
    )

    self.update_generate_inventory([target_host], restore_path=source_path)

    loader = DataLoader()
    inventory = InventoryManager(loader=loader, sources=self.inventory_path)
    callback = AnsiblePlayBookResultsCollector(
        sock=self.emitter, return_results=self.output_capture
    )
    variable_manager = VariableManager(loader=loader, inventory=inventory)

    executor = PlaybookExecutor(
        playbooks=[playbook],
        inventory=inventory,
        variable_manager=variable_manager,
        loader=loader,
        passwords=dict(),
    )
    executor._tqm._stdout_callback = callback
    executor.run()
    self.give_helpful_hints([target_host], backup=True, playbook=playbook)