Return codes in shell scripts

I need to determine the return value of pybrew in shell scripts.
Python commands have got the correct return, but these values ​​are lost in bashrc functions. I wrote a small patch that solves this problem.

P.S. Sorry for my bad English.