Moved from using list.copy to copy.deepcopy(list) for Python 2 compatibility.
Added Python 2.7 support.