Recursive Code For Python Project