code: def assert_pickle_idempotent(obj):
      '''Assert that obj does not change (w.r.t. ==) under repeated picklings
      '''
      from six.moves.cPickle import dumps, loads
      obj1 = loads(dumps(obj))
      obj2 = loads(dumps(obj1))
      obj3 = loads(dumps(obj2))
      assert_equivalent(obj, obj1)
      assert_equivalent(obj, obj2)
      assert_equivalent(obj, obj3)
      assert type(obj) is type(obj3f assert_pickle_idempotent(obj):
      '''Assert that obj does not change (w.r.t. ==) under repeated picklings
      '''
      from six.moves.cPickle import dumps, loads
      obj1 = loads(dumps(obj))
      obj2 = loads(dumps(obj1))
      obj3 = loads(dumps(obj2))
      assert_equivalent(obj, obj1)
      assert_equivalent(obj, obj2)
      assert_equivalent(obj, obj3)
      assert type(obj) is type(obj3)
docs: Assert that obj does not change (w.r.t. ==) under repeated picklings