code: def block_header_to_hex( block_data, prev_hash ):
      
      header_info = {
         "version": block_data['version'],
         "prevhash": prev_hash,
         "merkle_root": block_data['merkleroot'],
         "timestamp": block_data['time'],
         "bits": int(block_data['bits'], 16),
         "nonce": block_data['nonce'],
         "hash": block_data['hash']
      }
  
      return block_header_serialize(header_info)
docs: Calculate the hex form of a block's header, given its getblock information from bitcoind.