def __getstate__(self):
        d = self.__dict__.copy()
        for attr in ('reader', 'writer'):
            method = getattr(self, attr)
            try:
                # if instance method, pickle instance and method name
                d[attr] = method.__self__, method.__func__.__name__
            except __HOLE__:
                pass  # not an instance method
        return d
dataset/ETHPy150Open spotify/luigi/luigi/contrib/hdfs/format.py/CompatibleHdfsFormat.__getstate__