def re_subm(pat, repl, string):
 r = re_compile(pat)
 proxy = _re_subm_proxy()
 r.sub(proxy.__call__, string)
 return (r.sub(repl, string), proxy.match)

def re_subm ( pat , repl , string ) : r = re_compile ( pat ) proxy = _re_subm_proxy ( ) r . sub ( proxy . __call__ , string ) return ( r . sub ( repl , string ) , proxy . match )
like re .