Added compat module for better python 3 compatibility