def enforce(context, action, target):
 init()
 match_list = (('rule:%s' % action),)
 credentials = context.to_dict()
 policy.enforce(match_list, target, credentials, exception.PolicyNotAuthorized, action=action)

def enforce ( context , action , target ) : init ( ) match_list = ( ( 'rule:%s' % action ) , ) credentials = context . to_dict ( ) policy . enforce ( match_list , target , credentials , exception . PolicyNotAuthorized , action = action )
verifies that the action is valid on the target in this context .