def METHOD_NAME(code):
    lines = code.splitlines()
    # remove starting comments
    while len(lines) > 0 and lines[0].strip().startswith("#"):
        lines = lines[1:]
    # remove starting empty lines
    while len(lines) > 0 and lines[0].strip() == "":
        lines = lines[1:]
    # remove trailing empty lines
    while len(lines) > 0 and lines[-1].strip() == "":
        lines = lines[:-1]
    if len(lines) > 0:
        code = "\n".join(lines) + "\n"
        # if code is function definition/last line start with whitespace
        # end function definition with a second endline
        if re.match(r"^[ \t].*", lines[-1]) is not None:
            code += "\n"
        shell = get_workbench().show_view("ShellView", False)
        shell.submit_python_code(code)