Need your help in converting this function to use only recursion. Currently it's using a for loop and recursion but it needs to use only recursion. The function gets a list or a nested list and needs to return a copied list (deep copy!).
And I can not import deepcopy from copy or use list comprehension.
def my_deepcopy(nested_list: List[Any]) -> List[Any]:
results = []
for item in nested_list:
if not isinstance(item, list):
results.append(item)
else:
results.append(my_deepcopy(item))
return results