MAINT: use isMaskedArray instead of is_masked to check type

should close https://github.com/scipy/scipy/issues/3821