from functools import reduce


def strip_comment(text, commentid):
    """strips all text from lines in text after commentid
    """
    la = text.splitlines()
    for idx, l in enumerate(la):
        la[idx] = l.split(commentid, 1)[0]
    return reduce(lambda x, y: x + '\n' + y, la)