def create_policy(policyName, policyDocument, region=None, key=None, keyid=None, profile=None):
 try:
  conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
  if (not isinstance(policyDocument, string_types)):
   policyDocument = json.dumps(policyDocument)
  policy = conn.create_policy(policyName=policyName, policyDocument=policyDocument)
  if policy:
   log.info('The newly created policy version is {0}'.format(policy['policyVersionId']))
   return {'created': True, 'versionId': policy['policyVersionId']}
  else:
   log.warning('Policy was not created')
   return {'created': False}
 except ClientError as e:
  return {'created': False, 'error': salt.utils.boto3.get_error(e)}

def create_policy ( policyName , policyDocument , region = None , key = None , keyid = None , profile = None ) : try : conn = _get_conn ( region = region , key = key , keyid = keyid , profile = profile ) if ( not isinstance ( policyDocument , string_types ) ) : policyDocument = json . dumps ( policyDocument ) policy = conn . create_policy ( policyName = policyName , policyDocument = policyDocument ) if policy : log . info ( 'The newly created policy version is {0}' . format ( policy [ 'policyVersionId' ] ) ) return { 'created' : True , 'versionId' : policy [ 'policyVersionId' ] } else : log . warning ( 'Policy was not created' ) return { 'created' : False } except ClientError as e : return { 'created' : False , 'error' : salt . utils . boto3 . get_error ( e ) }
given a valid config .