Fix #7 hasattr implementation for python3

With associated unittest