Python Function Finding Prime Form