def wrap_check_policy(func):

    @functools.wraps(func)
    def wrapped(self, context, *args, **kwargs):
        action = func.__name__
        if not self.skip_policy_check:
            check_policy(context, action)
        return func(self, context, *args, **kwargs)

    return wrapped
Check policy corresponding to the wrapped methods prior to execution.
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/network/api.py/wrap_check_policy