def status(self, obj):
    warnings = []
    if (obj.routing == 'latency'):
        members_by_region = {}
        for member in obj.members.all():
            members_by_region.setdefault(member.region, []).append(member)
        if (len(members_by_region) <= 1):
            warnings.append('&#x2716; Latency routed policy should span multiple regions!')
        for (region, members) in members_by_region.items():
            if (len([m for m in members if (m.weight > 0)]) == 0):
                warnings.append('&#x2716; All members of region {} have weight zero!'.format(region))
    elif (obj.routing == 'weighted'):
        active_members = [m for m in obj.members.all() if (m.weight > 0)]
        if (len(active_members) == 0):
            warnings.append('&#x2716; All members have weight zero!')
    if warnings:
        return '<span style="color: red">{}</red>'.format('<br>'.join(warnings))
    else:
        return '&#x2714; ok'
def status(self, obj):
    warnings = []
    if (obj.routing == 'latency'):
        members_by_region = {}
        for member in obj.members.all():
            members_by_region.setdefault(member.region, []).append(member)
        if (len(members_by_region) <= 1):
            warnings.append('&#x2716; Latency routed policy should span multiple regions!')
        for (region, members) in members_by_region.items():
            if (len([m for m in members if (m.weight > 0)]) == 0):
                warnings.append('&#x2716; All members of region {} have weight zero!'.format(region))
    elif (obj.routing == 'weighted'):
        active_members = [m for m in obj.members.all() if (m.weight > 0)]
        if (len(active_members) == 0):
            warnings.append('&#x2716; All members have weight zero!')
    if warnings:
        return '<span style="color: red">{}</red>'.format('<br>'.join(warnings))
    else:
        return '&#x2714; ok'