def create_runner(code: str, timeout: int = 30) -> str:
    """
    Create a Python script that runs the code and prints the output
    """
    code = GenericEscape().escape(code)
    # Create a runner script
    runner = f"""
import os
import subprocess

my_env = os.environ.copy()
my_env["PYTHONIOENCODING"] = "utf-8"

process = subprocess.Popen(
    f"python -i -q -u".split(),
    stdin=subprocess.PIPE,
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE,
    text=True,
    bufsize=0,
    universal_newlines=True,
    env=my_env
)

process.stdin.write("{code}" + "\\n")
process.stdin.write("exit()\\n")
process.stdin.flush()

try:
    process.wait({timeout})
except Exception as e:
    process.terminate()

for line in iter(process.stdout.readline, ""):
    print(line)
    
for line in iter(process.stderr.readline, ""):
    if line.startswith(">>>"):
        continue
    print(line)
"""
    return runner

    Create a Python script that runs the code and prints the output
    
src/aios/ai_functions/code_interpreter.py