input: 
  def hash_block(block):
      """ This function takes a block object which has attributes: index, timestamp, data, and previous_hash. It calculates and returns the hash of the block contents using SHA-256.
      >>> block = Block(1, '2023-04-01T12:00:00Z', 'Transaction data', '0')
      >>> hash_block(block)
      '9b3b8b8c43c8a03e1b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b'
      """
  
output:     import hashlib
  
      block_string = f"{block.index}{block.timestamp}{block.data}{block.previous_hash}".encode()
      return hashlib.sha256(block_string).hexdigest()