Given route table properties, return details of all matching route tables.

    This function requires boto3 to be installed.

    .. versionadded:: 2016.11.0

    CLI Example:

    .. code-block:: bash

        salt myminion boto_vpc.describe_route_tables vpc_id='vpc-a6a9efc3'

def describe_route_tables(route_table_id=None, route_table_name=None,
                         vpc_id=None,
                         tags=None, region=None, key=None, keyid=None,
                         profile=None):
    '''
    Given route table properties, return details of all matching route tables.

    This function requires boto3 to be installed.

    .. versionadded:: 2016.11.0

    CLI Example:

    .. code-block:: bash

        salt myminion boto_vpc.describe_route_tables vpc_id='vpc-a6a9efc3'

    '''

    if not any((route_table_id, route_table_name, tags, vpc_id)):
        raise SaltInvocationError('At least one of the following must be specified: '
                                  'route table id, route table name, vpc_id, or tags.')

    try:
        conn3 = _get_conn3(region=region, key=key, keyid=keyid, profile=profile)
        filter_parameters = {'Filters': []}

        if route_table_id:
            filter_parameters['RouteTableIds'] = [route_table_id]

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

        if route_table_name:
            filter_parameters['Filters'].append({'Name': 'tag:Name', 'Values': [route_table_name]})

        if tags:
            for tag_name, tag_value in six.iteritems(tags):
                filter_parameters['Filters'].append({'Name': 'tag:{0}'.format(tag_name),
                                                     'Values': [tag_value]})

        route_tables = conn3.describe_route_tables(**filter_parameters).get('RouteTables', [])

        if not route_tables:
            return []

        tables = []
        keys = {'id': 'RouteTableId',
                'vpc_id': 'VpcId',
                'tags': 'Tags',
                'routes': 'Routes',
                'associations': 'Associations'
            }
        route_keys = {'destination_cidr_block': 'DestinationCidrBlock',
                      'gateway_id': 'GatewayId',
                      'instance_id': 'Instance',
                      'interface_id': 'NetworkInterfaceId',
                      'nat_gateway_id': 'NatGatewayId',
                      'vpc_peering_connection_id': 'VpcPeeringConnectionId',
                      }
        assoc_keys = {'id': 'RouteTableAssociationId',
                      'main': 'Main',
                      'route_table_id': 'RouteTableId',
                      'SubnetId': 'subnet_id',
                      }
        for item in route_tables:
            route_table = {}
            for outkey, inkey in six.iteritems(keys):
                if inkey in item:
                    if outkey == 'routes':
                        route_table[outkey] = _key_remap(inkey, route_keys, item)
                    elif outkey == 'associations':
                        route_table[outkey] = _key_remap(inkey, assoc_keys, item)
                    elif outkey == 'tags':
                        route_table[outkey] = {}
                        for tagitem in item.get(inkey, []):
                            route_table[outkey][tagitem.get('Key')] = tagitem.get('Value')
                    else:
                        route_table[outkey] = item.get(inkey)
            tables.append(route_table)
        return tables

    except BotoServerError as e:
        return {'error': __utils__['boto.get_error'](e)}