py2 and py3 mock compatibility