Python text sanitization and processing utils