'Transform the Block to a Python dictionary.
Returns:
dict: The Block as a dict.
Raises:
ValueError: If the Block doesn\'t contain any transactions.'

def to_dict(self):

    if (len(self.transactions) == 0):
        raise ValueError('Empty    block    creation    is    not    allowed')
    block = {'timestamp': self.timestamp, 'transactions': [tx.to_dict() for tx in self.transactions], 'node_pubkey': self.node_pubkey, 'voters': self.voters}
    block_serialized = serialize(block)
    block_id = hash_data(block_serialized)
    return {'id': block_id, 'block': block, 'signature': self.signature}
