def repl(m): try: #return debase64(m.group(1)).decode('utf-16') return debase64(m.group(1)) except: LOG.error('cannot decode %r', m.group(0)) return m.group(0)