class_docstr: A subclass of pickler, to do cryptographic hashing, rather than
  pickling.
class_docstr_tok: ["A","subclass","of","pickler",",","to","do","cryptographic","hashing",",","rather","than","pickling","."]
code: def _batch_setitems(self, items):
      # forces order of keys in dict to ensure consistent hash.
      try:
          # Trying first to compare dict assuming the type of keys is
          # consistent and orderable.
          # This fails on python 3 when keys are unorderable
          # but we keep it in a try as it's faster.
          Pickler._batch_setitems(self, iter(sorted(items)))
      except TypeError:
          # If keys are unorderable, sorting them using their hash. This is
          # slower but works in any case.
          Pickler._batch_setitems(
              self, iter(sorted((hash(k), v) for k, v in items))
          )
  
imports: import pickle
  import hashlib
  import sys
  import types
  import struct
  import io
  import decimal
  from ._compat import _bytes_or_unicode, PY3_OR_LATER
label_desc: Use image node_id 6 for calling the Hasher obj's underlying member method code with example usage: obj._batch_setitems(items) without return types