Save the status of the object in pickle format.
        Returns 0 if success

def pickle_dump(self):
        """
        Save the status of the object in pickle format.
        Returns 0 if success
        """
        if self.has_chrooted:
            warnings.warn("Cannot pickle_dump since we have chrooted from %s" % self.has_chrooted)
            return -1

        #if self.in_spectator_mode:
        #    warnings.warn("Cannot pickle_dump since flow is in_spectator_mode")
        #    return -2

        protocol = self.pickle_protocol

        # Atomic transaction with FileLock.
        with FileLock(self.pickle_file):
            with AtomicFile(self.pickle_file, mode="wb") as fh:
                pmg_pickle_dump(self, fh, protocol=protocol)

        return 0