[python] improve HxOverride implementations of toLowerCase and toUpperCase