import re


def strip_comments(comment_regex,text): 
    """ Removes comments defined by `comment_regex` from `text`. """ 
    text = re.sub(comment_regex,'',text)
    text = text.splitlines()# Split into lines
    return text