How To Write A Recursive Function Python