@staticmethod
  def ComputeHashPrefix(id, num_bytes=1):
    """Returns a hash prefix from 64-bit id with the specified number
    of bytes. The hash prefix for an ID is typically used to achieve
    uniform distribution of keys across shards. The high bytes of the
    crc32 checksum are used first.
    """
    assert num_bytes - 1 in xrange(4), num_bytes
    return zlib.crc32(struct.pack('>Q', id)) & [0xff, 0xffff, 0xffffff, 0xffffffff][num_bytes - 1]
dataset/ETHPy150Open viewfinderco/viewfinder/backend/db/id_allocator.py/IdAllocator.ComputeHashPrefix/original