input: Write a function to implement a basic blockchain in Python using only the core modules. The function should create a Blockchain class with methods to initialize the chain, create a new block with a given nonce and previous hash, get the current timestamp, and hash a block using SHA-256.
  
  
  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
  
  blockchain = Blockchain()
  block = blockchain.create_block(nonce=12345, previous_hash='0')
  assert blockchain.hash_block(block) == '3a7bd3e2360a3e2d73269df738df2og234g8dfg3o4g83dfo4g83dfg3o4g83dfg3o4g'
  assert blockchain.chain[0]['block_number'] == 1
  assert blockchain.chain[0]['nonce'] == 12345
  assert blockchain.chain[0]['previous_hash'] == '0'
  assert blockchain.hash_block(block) != 'invalid_hash'
  
output: 
  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
  