def trim_line( segs, text, start, end ):
    l = []
    x = 0
    for seg in segs:
        sc = seg[0]
        if start or sc < 0:
            if start >= sc:
                start -= sc
                x += sc
                continue
            s = LayoutSegment(seg)
            if x+sc >= end:
                # can all be done at once
                return s.subseg( text, start, end-x )
            l += s.subseg( text, start, sc )
            start = 0
            x += sc
            continue
        if x >= end:
            break
        if x+sc > end:
            s = LayoutSegment(seg)
            l += s.subseg( text, 0, end-x )
            break
        l.append( seg )
    return l
If no image is posted, the group image should be None.
dataset/ETHPy150Open AnyMesh/anyMesh-Python/example/urwid/text_layout.py/trim_line--crossover with--dataset/ETHPy150Open ofa/connect/open_connect/groups/tests/test_views.py/GroupCreateViewTest.test_form_valid_no_image