code: def _hack_namedtuple(cls):
      
      name = cls.__name__
      fields = cls._fields
  
      def __reduce__(self):
          return (_restore, (name, fields, tuple(self)))
      cls.__reduce__ = __reduce__
      cls._is_namedtuple_ = True
      return cls
docs: Make class generated by namedtuple picklable