input: Write a function to implement a basic blockchain in Python using only the core modules. The function should include a class named Blockchain and methods to create a block, get the current timestamp, and hash a block. Include assert test cases to verify the functionality of the methods.
  
  import hashlib
  import json
  import time
  
  class Blockchain:
  
   def __init__(self):
   self.chain = []
   self.transactions = []
  
   def create_block(self, nonce, previous_hash):
   block = {
   'block_number': len(self.chain) + 1,
   'timestamp': self._current_timestamp(),
   'nonce': nonce,
   'previous_hash': previous_hash
   }
   self.chain.append(block)
   return block
  
   def _current_timestamp(self):
   return round(time.time() * 1000)
  
   def hash_block(self, block):
   string_object = json.dumps(block, sort_keys=True)
   block_string = string_object.encode()
   raw_hash = hashlib.sha256(block_string)
   hex_hash = raw_hash.hexdigest()
   return hex_hash
  
  # Test cases
  blockchain = Blockchain()
  block1 = blockchain.create_block(12345, "0")
  block1_hash = blockchain.hash_block(block1)
  assert block1['block_number'] == 1
  assert isinstance(block1['timestamp'], int)
  assert block1_hash.startswith("0")  # Simplified hash check
  
  block2 = blockchain.create_block(67890, block1_hash)
  block2_hash = blockchain.hash_block(block2)
  assert block2['block_number'] == 2
  assert block2['previous_hash'] == block1_hash
  assert isinstance(block2['timestamp'], int)
  assert block2_hash.startswith("0")  # Simplified hash check
  
  assert len(blockchain.chain) == 2
  assert blockchain.chain[0] == block1
  assert blockchain.chain[1] == block2
output: 
  import hashlib
  import json
  import time
  
  class Blockchain:
  
   def __init__(self):
   self.chain = []
   self.transactions = []
  
   def create_block(self, nonce, previous_hash):
   block = {
   'block_number': len(self.chain) + 1,
   'timestamp': self._current_timestamp(),
   'nonce': nonce,
   'previous_hash': previous_hash
   }
   self.chain.append(block)
   return block
  
   def _current_timestamp(self):
   return round(time.time() * 1000)
  
   def hash_block(self, block):
   string_object = json.dumps(block, sort_keys=True)
   block_string = string_object.encode()
   raw_hash = hashlib.sha256(block_string)
   hex_hash = raw_hash.hexdigest()
   return hex_hash
  