code: def hex_to_hash(hexstr):
      # type: (str) -> ImageHash
      """
      Convert a stored hash (hex, as retrieved from str(Imagehash))
      back to a Imagehash object.
  
      Notes:
      1. This algorithm assumes all hashes are either
                      bidimensional arrays with dimensions hash_size * hash_size,
                      or onedimensional arrays with dimensions binbits * 14.
      2. This algorithm does not work for hash_size < 2.
      """
      hash_size = int(numpy.sqrt(len(hexstr) * 4))
      # assert hash_size == numpy.sqrt(len(hexstr)*4)
      binary_array = "{:0>{width}b}".format(
          int(hexstr, 16), width=hash_size * hash_size
      )
      bit_rows = [
          binary_array[i : i + hash_size]
          for i in range(0, len(binary_array), hash_size)
      ]
      hash_array = numpy.array(
          [[bool(int(d)) for d in row] for row in bit_rows]
      )
      return ImageHash(hash_array)
  
imports: from __future__ import absolute_import, division, print_function
  import sys
  import numpy
  from PIL import Image, ImageFilter
label_desc: Use image node_id 2 for calling a global function with example usage: hex_to_hash(hexstr) and returns: ImageHash