'Execute a set of lines as multiple command
lines: multiple lines of text to be executed as single commands'

def execute_lines(self, lines):

    for line in lines.splitlines():
        stripped_line = line.strip()
        if stripped_line.startswith('#'):
            continue
        self.write((line + os.linesep), flush=True)
        self.execute_command((line + '\n'))
        self.flush()
