def split_lines(text):
    """Split text into lines.
       Removes comments, blank lines, and strips/trims whitespace.
    """
    lines = []
    for line in text.splitlines():
        if '#' in line:
            line = line[:line.index('#')]
        line = line.strip()
        if line:
            lines.append(line)
    return lines