@register.filter
def truncate_chars(value, max_length):
    max_length = int(max_length)
    if len(value) > max_length:
        truncd_val = value[:max_length-1]
        if value[max_length] != " ":
            truncd_val = truncd_val[:truncd_val.rfind(" ")]
        return  truncd_val + "..."
    return value
The Best Fit Decreasing (BFD) heuristic for placing VMs on hosts.
dataset/ETHPy150Open rvanlaar/easy-transifex/src/transifex/transifex/txcommon/templatetags/truncate.py/truncate_chars--crossover with--dataset/ETHPy150Open beloglazov/openstack-neat/neat/globals/vm_placement/bin_packing.py/best_fit_decreasing