def get_used_space_in_data_centers(data_centers):
    used_by_accessories = RackAccessory.objects.filter(
        rack__server_room__data_center__in=data_centers,
    ).values_list(
        'rack__server_room__data_center__name'
    ).annotate(
        s=Count('rack')
    )
    used_by_assets = DataCenterAsset.objects.filter(
        rack__server_room__data_center__in=data_centers,
        model__has_parent=False,
        rack__require_position=True
    ).values_list(
        'rack__server_room__data_center__name'
    ).annotate(
        s=Sum('model__height_of_device')
    )
    return Counter(dict(used_by_assets)) + Counter(dict(used_by_accessories))
dataset/ETHPy150Open allegro/ralph/src/ralph/admin/templatetags/dashboard_tags.py/get_used_space_in_data_centers/original