Adding python api for serilizing + performance improvement + making logs more readable