Python Function Finding Prime Factor