input: Write a function to implement a basic blockchain in Python using only the core modules. The function should include methods for initializing the blockchain, creating new blocks, and hashing blocks. It should also return a blockchain object that can be used for further manipulation.
  
  
  import hashlib
  import json
  import time
  
  def create_blockchain():
   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
  
   return Blockchain()
  
  # Test cases
  blockchain = create_blockchain()
  assert blockchain.create_block(12345, '0')['block_number'] == 1
  assert isinstance(blockchain.hash_block(blockchain.chain[0]), str)
  
output: 
  import hashlib
  import json
  import time
  
  def create_blockchain():
   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
  
   return Blockchain()
  