How to Solve NameError: name 'deepcopy' is not defined -- copy

Solution: Import the 'deepcopy' module

# Add the following line to the top of your code
from copy import deepcopy

 

For more information:
copy deepcopy