def sync_command(command_name, validator=None):
    def sync_decorator(func):
        func.command_name = command_name

        @functools.wraps(func)
        def wrapper(self, **command_params):
            # Run a validator before invoking the function.
            # validators should raise exceptions or return silently.
            if validator:
                validator(self, **command_params)

            result = func(self, **command_params)
            return SyncCommandResult(command_name,
                                     command_params,
                                     True,
                                     result)

        return wrapper
    return sync_decorator
Test documentation.
dataset/ETHPy150Open openstack/ironic-python-agent/ironic_python_agent/extensions/base.py/sync_command--crossover with--dataset/ETHPy150Open kdart/pycopia/fepy/test.py/FepyTests.test_works