docs: def block_header_serialize( inp ):
      """
      Given block header information, serialize it and return the hex hash.
  
      inp has:
      * version (int)
      * prevhash (str)
      * merkle_root (str)
      * timestamp (int)
      * bits (int)
      * nonce (int)
  
      Based on code from pybitcointools (https://github.com/vbuterin/pybitcointools)
      by Vitalik Buterin
      """
      
      # concatenate to form header
      o = encoding.encode(inp['version'], 256, 4)[::-1] + \
          inp['prevhash'].decode('hex')[::-1] + \
          inp['merkle_root'].decode('hex')[::-1] + \
          encoding.encode(inp['timestamp'], 256, 4)[::-1] + \
          encoding.encode(inp['bits'], 256, 4)[::-1] + \
          encoding.encode(inp['nonce'], 256, 4)[::-1]
  
      # get (reversed) hash
      h = hashing.bin_sha256(hashing.bin_sha256(o))[::-1].encode('hex')
      assert h == inp['hash'], (hashing.bin_sha256(o).encode('hex'), inp['hash'])
  
      return o.encode('hex')