Create a policy.

    CLI Example:

    .. code-block:: bash

        salt myminios boto_iam.create_policy mypolicy '{"Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": ["s3:Get*", "s3:List*"], "Resource": ["arn:aws:s3:::my-bucket/shared/*"]},]}'

def create_policy(policy_name, policy_document, path=None, description=None,
                 region=None, key=None, keyid=None, profile=None):
    '''
    Create a policy.

    CLI Example:

    .. code-block:: bash

        salt myminios boto_iam.create_policy mypolicy '{"Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": ["s3:Get*", "s3:List*"], "Resource": ["arn:aws:s3:::my-bucket/shared/*"]},]}'
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    if not isinstance(policy_document, six.string_types):
        policy_document = salt.utils.json.dumps(policy_document)
    params = {}
    for arg in 'path', 'description':
        if locals()[arg] is not None:
            params[arg] = locals()[arg]
    if policy_exists(policy_name, region, key, keyid, profile):
        return True
    try:
        conn.create_policy(policy_name, policy_document, **params)
        log.info('Created IAM policy %s.', policy_name)
    except boto.exception.BotoServerError as e:
        log.debug(e)
        log.error('Failed to create IAM policy %s.', policy_name)
        return False
    return True