def strip_python_stderr(stderr):
 stderr = re.sub('\\[\\d+ refs\\]\\r?\\n?$'.encode(), ''.encode(), stderr).strip()
 return stderr

def strip_python_stderr ( stderr ) : stderr = re . sub ( '\\[\\d+ refs\\]\\r?\\n?$' . encode ( ) , '' . encode ( ) , stderr ) . strip ( ) return stderr
strip the stderr of a python process from potential debug output emitted by the interpreter .