'Detailed view of a single consistency group.'

def detail(self, request, consistencygroup):

    try:
        volume_types = (consistencygroup.volume_type_id.split(',') if consistencygroup.volume_type_id else [])
        volume_types = [type_id for type_id in volume_types if type_id]
    except AttributeError:
        try:
            volume_types = [v_type.id for v_type in consistencygroup.volume_types]
        except AttributeError:
            volume_types = []
    return {'consistencygroup': {'id': consistencygroup.id, 'status': consistencygroup.status, 'availability_zone': consistencygroup.availability_zone, 'created_at': consistencygroup.created_at, 'name': consistencygroup.name, 'description': consistencygroup.description, 'volume_types': volume_types}}
