Given gateway properties, find and return matching nat gateways

def _find_nat_gateways(nat_gateway_id=None, subnet_id=None, subnet_name=None, vpc_id=None, vpc_name=None,
                       states=('pending', 'available'),
                       region=None, key=None, keyid=None, profile=None):
    '''
    Given gateway properties, find and return matching nat gateways
    '''

    if not any((nat_gateway_id, subnet_id, subnet_name, vpc_id, vpc_name)):
        raise SaltInvocationError('At least one of the following must be '
                                  'provided: nat_gateway_id, subnet_id, '
                                  'subnet_name, vpc_id, or vpc_name.')
    filter_parameters = {'Filter': []}

    if nat_gateway_id:
        filter_parameters['NatGatewayIds'] = [nat_gateway_id]

    if subnet_name:
        subnet_id = _get_resource_id('subnet', subnet_name,
                                     region=region, key=key,
                                     keyid=keyid, profile=profile)
        if not subnet_id:
            return False

    if subnet_id:
        filter_parameters['Filter'].append({'Name': 'subnet-id', 'Values': [subnet_id]})

    if vpc_name:
        vpc_id = _get_resource_id('vpc', vpc_name,
                                     region=region, key=key,
                                     keyid=keyid, profile=profile)
        if not vpc_id:
            return False

    if vpc_id:
        filter_parameters['Filter'].append({'Name': 'vpc-id', 'Values': [vpc_id]})

    conn3 = _get_conn3(region=region, key=key, keyid=keyid, profile=profile)
    nat_gateways = []
    for ret in __utils__['boto3.paged_call'](conn3.describe_nat_gateways,
                                           marker_flag='NextToken', marker_arg='NextToken',
                                           **filter_parameters):
        for gw in ret.get('NatGateways', []):
            if gw.get('State') in states:
                nat_gateways.append(gw)
    log.debug('The filters criteria %s matched the following nat gateways: %s',
              filter_parameters, nat_gateways)

    if nat_gateways:
        return nat_gateways
    else:
        return False