'Serialize the header to a readable dictionary.'

def to_dict(self):

    d = {}
    for field in ('prevhash', 'uncles_hash', 'extra_data', 'nonce', 'mixhash'):
        d[field] = ('0x' + encode_hex(getattr(self, field)))
    for field in ('state_root', 'tx_list_root', 'receipts_root', 'coinbase'):
        d[field] = encode_hex(getattr(self, field))
    for field in ('number', 'difficulty', 'gas_limit', 'gas_used', 'timestamp'):
        d[field] = utils.to_string(getattr(self, field))
    d['bloom'] = encode_hex(int256.serialize(self.bloom))
    assert (len(d) == len(BlockHeader.fields))
    return d
