nl: alternatively, if six.PY3 is true check if message does not have an attribute 'message', if six.PY3 is false, check if message doesnt have an attribute 'code', perform the following,
code: elif not hasattr ( message , 'message' if six . PY3 else 'code' ) :