def file_lines(f):
    """Read lines from a file (f) into a list."""
    try:
        f = open(f)
    except TypeError:
        # probably already a file.
        pass
    with f:
        lines = f.readlines()
    lines = [line.strip() for line in lines]
    return lines