Change func_code to __code__ to work with python 3