'Get variables about a specific host'

def get_host_info(self):

    if (len(self.index) == 0):
        self.load_index_from_cache()
    if (not (self.args.host in self.index)):
        self.do_api_calls_update_cache()
        if (not (self.args.host in self.index)):
            return self.json_format_dict({}, True)
    (region, instance_id) = self.index[self.args.host]
    instance = self.get_instance(region, instance_id)
    instance_vars = {}
    for key in vars(instance):
        value = getattr(instance, key)
        key = self.to_safe(('ec2_' + key))
        if (type(value) in [int, bool]):
            instance_vars[key] = value
        elif (type(value) in [str, unicode]):
            instance_vars[key] = value.strip()
        elif (type(value) == type(None)):
            instance_vars[key] = ''
        elif (key == 'ec2_region'):
            instance_vars[key] = value.name
        elif (key == 'ec2_tags'):
            for (k, v) in value.iteritems():
                key = self.to_safe(('ec2_tag_' + k))
                instance_vars[key] = v
        elif (key == 'ec2_groups'):
            group_ids = []
            group_names = []
            for group in value:
                group_ids.append(group.id)
                group_names.append(group.name)
            instance_vars['ec2_security_group_ids'] = ','.join(group_ids)
            instance_vars['ec2_security_group_names'] = ','.join(group_names)
        else:
            pass
    return self.json_format_dict(instance_vars, True)
