def openreadlines(filename, xform=None):
    """Open a file and return a list of all its lines.

xform -- a function to run on all lines"""
    with open(filename, "r", encoding="utf-8") as infp:
        return [xform(x) if xform else x for x in infp]