implemented function convert_mask with test suite