code: def _hash2xy(hashcode, dim):
      
      assert(hashcode <= dim * dim - 1)
      x = y = 0
      lvl = 1
      while (lvl < dim):
          rx = 1 & (hashcode >> 1)
          ry = 1 & (hashcode ^ rx)
          x, y = _rotate(lvl, x, y, rx, ry)
          x += lvl * rx
          y += lvl * ry
          hashcode >>= 2
          lvl <<= 1
      return x, y
docs: Convert hashcode to (x, y).
  
      Based on the implementation here:
          https://en.wikipedia.org/w/index.php?title=Hilbert_curve&oldid=797332503
  
      Pure python implementation.
  
      Parameters:
          hashcode: int  Hashcode to decode [0, dim**2)
          dim: int       Number of coding points each x, y value can take.
                         Corresponds to 2^level of the hilbert curve.
  
      Returns:
          Tuple[int, int]: (x, y) point in dim x dim-grid system