def create_policy_version(policy_name, policy_document, set_as_default=None, region=None, key=None, keyid=None, profile=None):
 conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
 if (not isinstance(policy_document, six.string_types)):
  policy_document = json.dumps(policy_document)
 params = {}
 for arg in ('set_as_default',):
  if (locals()[arg] is not None):
   params[arg] = locals()[arg]
 policy_arn = _get_policy_arn(policy_name, region, key, keyid, profile)
 try:
  ret = conn.create_policy_version(policy_arn, policy_document, **params)
  vid = ret.get('create_policy_version_response', {}).get('create_policy_version_result', {}).get('policy_version', {}).get('version_id')
  log.info('Created {0} policy version {1}.'.format(policy_name, vid))
  return {'created': True, 'version_id': vid}
 except boto.exception.BotoServerError as e:
  log.debug(e)
  msg = 'Failed to create {0} policy version.'
  log.error(msg.format(policy_name))
  return {'created': False, 'error': __utils__['boto.get_error'](e)}

def create_policy_version ( policy_name , policy_document , set_as_default = None , region = None , key = None , keyid = None , profile = None ) : conn = _get_conn ( region = region , key = key , keyid = keyid , profile = profile ) if ( not isinstance ( policy_document , six . string_types ) ) : policy_document = json . dumps ( policy_document ) params = { } for arg in ( 'set_as_default' , ) : if ( locals ( ) [ arg ] is not None ) : params [ arg ] = locals ( ) [ arg ] policy_arn = _get_policy_arn ( policy_name , region , key , keyid , profile ) try : ret = conn . create_policy_version ( policy_arn , policy_document , ** params ) vid = ret . get ( 'create_policy_version_response' , { } ) . get ( 'create_policy_version_result' , { } ) . get ( 'policy_version' , { } ) . get ( 'version_id' ) log . info ( 'Created {0} policy version {1}.' . format ( policy_name , vid ) ) return { 'created' : True , 'version_id' : vid } except boto . exception . BotoServerError as e : log . debug ( e ) msg = 'Failed to create {0} policy version.' log . error ( msg . format ( policy_name ) ) return { 'created' : False , 'error' : __utils__ [ 'boto.get_error' ] ( e ) }
given a valid config .