The deepcopy() function in Python is used to create a new object with a completely new memory address, which is a deep copy of the original object. It means that any changes made to the copied object will not affect the original object, and vice versa.

deepcopy() function is useful when you need to modify an object without changing the original object. It recursively copies all the objects referenced by the original object, and creates a new object containing the copied objects.

Here is an example of using deepcopy() function:

import copy

original_list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
copied_list = copy.deepcopy(original_list)

# Modify the copied_list
copied_list[0][0] = 10

# The original list is not affected
print(original_list)  # Output: [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
print(copied_list)  # Output: [[10, 2, 3], [4, 5, 6], [7, 8, 9]]