Check if a VPC peering connection is in the pending state.

    .. versionadded:: 2016.11.0

    conn_id
        The connection ID to check.  Exclusive with conn_name.

    conn_name
        The connection name to check.  Exclusive with conn_id.

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

    profile
        A dict with region, key and keyid, or a pillar key (string) that
        contains a dict with region, key and keyid.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_vpc.is_peering_connection_pending conn_name=salt-vpc
        # Specify a region
        salt myminion boto_vpc.is_peering_connection_pending conn_name=salt-vpc region=us-west-2
        # specify an id
        salt myminion boto_vpc.is_peering_connection_pending conn_id=pcx-8a8939e3

def is_peering_connection_pending(conn_id=None, conn_name=None, region=None,
                                  key=None, keyid=None, profile=None):
    '''
    Check if a VPC peering connection is in the pending state.

    .. versionadded:: 2016.11.0

    conn_id
        The connection ID to check.  Exclusive with conn_name.

    conn_name
        The connection name to check.  Exclusive with conn_id.

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

    profile
        A dict with region, key and keyid, or a pillar key (string) that
        contains a dict with region, key and keyid.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_vpc.is_peering_connection_pending conn_name=salt-vpc
        # Specify a region
        salt myminion boto_vpc.is_peering_connection_pending conn_name=salt-vpc region=us-west-2
        # specify an id
        salt myminion boto_vpc.is_peering_connection_pending conn_id=pcx-8a8939e3

    '''
    if not _exactly_one((conn_id, conn_name)):
        raise SaltInvocationError('Exactly one of conn_id or conn_name must be provided.')

    conn = _get_conn3(region=region, key=key, keyid=keyid, profile=profile)

    if conn_id:
        vpcs = conn.describe_vpc_peering_connections(VpcPeeringConnectionIds=[conn_id]).get('VpcPeeringConnections', [])
    else:
        filters = [{'Name': 'tag:Name', 'Values': [conn_name]},
                   {'Name': 'status-code', 'Values': [ACTIVE, PENDING_ACCEPTANCE, PROVISIONING]}]
        vpcs = conn.describe_vpc_peering_connections(Filters=filters).get('VpcPeeringConnections', [])

    if not vpcs:
        return False
    elif len(vpcs) > 1:
        raise SaltInvocationError('Found more than one ID for the VPC peering '
                                  'connection ({0}). Please call this function '
                                  'with an ID instead.'.format(conn_id or conn_name))
    else:
        status = vpcs[0]['Status']['Code']

    return status == PENDING_ACCEPTANCE