def clip(text, max_len=80):
    end = None
    if len(text) > max_len:
        space_before = text.rfind(' ', 0, max_len)
        if space_before >= 0:
            end = space_before
        else:
            space_after = text.rfind(' ', max_len)
            if space_after >= 0:
                end = space_after
    if end is None:  # no spaces were found
        end = len(text)
    return text[:end].rstrip()

# END CLIP
Delete an item
dataset/ETHPy150Open fluentpython/example-code/05-1class-func/clip.py/clip--crossover with--dataset/ETHPy150Open duerrp/pyexperiment/pyexperiment/utils/HierarchicalMapping.py/HierarchicalMapping.__delitem__