Python Recursive Function For Merge