def quotify(qtype, word, terminate):
 if (qtype == qq):
  return ((qq + word.replace(qq, '\\"')) + ((terminate and qq) or ''))
 elif (qtype == q):
  return ((q + word.replace(q, "\\'")) + ((terminate and q) or ''))
 else:
  return re.sub('([\\"\\\' \\t\\n\\r])', '\\\\\\1', word)

def quotify ( qtype , word , terminate ) : if ( qtype == qq ) : return ( ( qq + word . replace ( qq , '\\"' ) ) + ( ( terminate and qq ) or '' ) ) elif ( qtype == q ) : return ( ( q + word . replace ( q , "\\'" ) ) + ( ( terminate and q ) or '' ) ) else : return re . sub ( '([\\"\\\' \\t\\n\\r])' , '\\\\\\1' , word )
return a string corresponding to given word .