Refactored multitemp masking from yatsm.py

This change enables us to use the Cython implementation if avialable,
or default to the Python if not. Also cleans up the code quite a bit.