Fragmentation functions from semi-inclusive DIS pion production and implications for the polarized parton densities