@register.inclusion_tag('admin/templatetags/dc_capacity.html')
def dc_capacity(data_centers=None, size='big'):
    color = cycle(COLORS)
    if not data_centers:
        data_centers = DataCenter.objects.all()
    if not isinstance(data_centers, Iterable):
        data_centers = [data_centers]
    data_centers_mapper = dict(data_centers.values_list('name', 'id'))
    available_space = get_available_space_in_data_centers(data_centers)
    used_space = get_used_space_in_data_centers(data_centers)
    difference = dict(available_space - used_space)
    results = []
    for name, value in sorted(difference.items()):
        capacity = 100 - (100 * value / available_space[name])
        tooltip = '<strong>Free U:</strong> {} ({} in total)'.format(
            available_space[name] - int(used_space[name]),
            available_space[name]
        )
        results.append({
            'url': '{}#/dc/{}'.format(
                reverse('dc_view'), data_centers_mapper[name]
            ),
            'tooltip': tooltip,
            'size': size,
            'color': next(color),
            'dc': name,
            'capacity': int(capacity)
        })
    return {'capacities': results}
dataset/ETHPy150Open allegro/ralph/src/ralph/admin/templatetags/dashboard_tags.py/dc_capacity/original