python code of pso