def joinlines(lines):
    """Strip comments and join line continuations."""
    joined_line = ''
    for line in map(lambda x: x.strip(), lines):
        if not line or line.startswith('#'):
            continue
        if line.endswith('\\'):
            joined_line += line[:-1]
            continue
        yield joined_line + line
        joined_line = ''
