import os

def path_split(path):
    """This is a replacement for the combined use of os.path.split and
       os.path.splitext to decompose a relative path into its components.
    """
    path_and_file = path.rsplit(os.sep, 1)
    if len(path_and_file) <= 1:
        path = ""
    else:
        path = path_and_file[0]
    file_and_ext  = path_and_file[-1].rsplit(".", 1)
    if len(file_and_ext) <= 1:
        ext = ""
    else:
        ext = file_and_ext[-1]
    file_name = file_and_ext[0]
    return (path, file_name, ext)

def _read_raw(answer):
    buf = os.read(1, 32)
    if len(buf) == 0:
        return (answer, False)
    elif buf[-1] == "\n":
        return (answer + buf[:-1], False)
    else:
        return (answer + buf, True)

def raw_input(msg = ""):
    os.write(1, msg)
    answer, cont = _read_raw("")
    while cont:
        answer, cont = _read_raw(answer)
    return answer

@@ -499,17 +499,16 @@
  return 
-(
 path, fi
@@ -519,17 +519,16 @@
 ame, ext
-)
 %0A%0Adef _r
@@ -602,25 +602,24 @@
      return 
-(
 answer, Fals
@@ -615,25 +615,24 @@
 nswer, False
-)
 %0A    elif bu
@@ -653,33 +653,32 @@
 %0A        return 
-(
 answer + buf%5B:-1
@@ -685,17 +685,16 @@
 %5D, False
-)
 %0A    els
@@ -711,17 +711,16 @@
  return 
-(
 answer +
@@ -729,17 +729,16 @@
 uf, True
-)
 %0A%0Adef ra

Remove redundant parentheses