def _validateSetting(value, policy):
 log.debug('validating {0} for policy {1}'.format(value, policy))
 if ('Settings' in policy):
  if policy['Settings']:
   if isinstance(policy['Settings'], list):
    if (value not in policy['Settings']):
     return False
   elif isinstance(policy['Settings'], dict):
    _policydata = _policy_info()
    if (not getattr(_policydata, policy['Settings']['Function'])(value, **policy['Settings']['Args'])):
     return False
 else:
  return True
 return True

def _validateSetting ( value , policy ) : log . debug ( 'validating {0} for policy {1}' . format ( value , policy ) ) if ( 'Settings' in policy ) : if policy [ 'Settings' ] : if isinstance ( policy [ 'Settings' ] , list ) : if ( value not in policy [ 'Settings' ] ) : return False elif isinstance ( policy [ 'Settings' ] , dict ) : _policydata = _policy_info ( ) if ( not getattr ( _policydata , policy [ 'Settings' ] [ 'Function' ] ) ( value , ** policy [ 'Settings' ] [ 'Args' ] ) ) : return False else : return True return True
helper function to validate specified value is appropriate for the policy if the settings key is a list .