'Adds an RDS instance to the inventory and index, as long as it is
addressable'

def add_rds_instance(self, instance, region):

    if ((not self.all_rds_instances) and (instance.status != 'available')):
        return
    dest = instance.endpoint[0]
    if (not dest):
        return
    self.index[dest] = [region, instance.id]
    self.inventory[instance.id] = [dest]
    if self.nested_groups:
        self.push_group(self.inventory, 'instances', instance.id)
    if self.nested_groups:
        self.push_group(self.inventory, 'regions', region)
    else:
        self.push(self.inventory, region, dest)
    self.push(self.inventory, instance.availability_zone, dest)
    if self.nested_groups:
        self.push_group(self.inventory, region, instance.availability_zone)
    type_name = self.to_safe(('type_' + instance.instance_class))
    self.push(self.inventory, type_name, dest)
    if self.nested_groups:
        self.push_group(self.inventory, 'types', type_name)
    try:
        if instance.security_group:
            key = self.to_safe(('security_group_' + instance.security_group.name))
            self.push(self.inventory, key, dest)
            if self.nested_groups:
                self.push_group(self.inventory, 'security_groups', key)
    except AttributeError:
        print 'Package    boto    seems    a    bit    older.'
        print 'Please    upgrade    boto    >=    2.3.0.'
        sys.exit(1)
    self.push(self.inventory, self.to_safe(('rds_' + instance.engine)), dest)
    if self.nested_groups:
        self.push_group(self.inventory, 'rds_engines', self.to_safe(('rds_' + instance.engine)))
    self.push(self.inventory, self.to_safe(('rds_parameter_group_' + instance.parameter_group.name)), dest)
    if self.nested_groups:
        self.push_group(self.inventory, 'rds_parameter_groups', self.to_safe(('rds_parameter_group_' + instance.parameter_group.name)))
    self.push(self.inventory, 'rds', dest)
    self.inventory['_meta']['hostvars'][dest] = self.get_host_info_dict_from_instance(instance)
