Return a string with the pickle representation.
        `protocol` selects the pickle protocol. self.pickle_protocol is
         used if `protocol` is None

def pickle_dumps(self, protocol=None):
        """
        Return a string with the pickle representation.
        `protocol` selects the pickle protocol. self.pickle_protocol is
         used if `protocol` is None
        """
        strio = StringIO()
        pmg_pickle_dump(self, strio,
                        protocol=self.pickle_protocol if protocol is None
                        else protocol)
        return strio.getvalue()