input: Write a function to create a basic blockchain in Python using only the core modules. The class should have methods to initialize the blockchain, create a new block, and hash a block. If the blockchain is created successfully, return the class with the implemented methods. If the input is invalid or the blockchain cannot be created, return None.
  
  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):
          import time
          return round(time.time() * 1000)
      def hash_block(self, block):
          import hashlib
          import json
          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
  
  assert Blockchain is not None
  blockchain = Blockchain()
  block1 = blockchain.create_block(12345, "0")
  block2 = blockchain.create_block(67890, blockchain.hash_block(block1))
  assert block1['block_number'] == 1
  assert block2['block_number'] == 2
  assert blockchain.hash_block(block1) == blockchain.hash_block(block1)
  assert blockchain.hash_block(block2) != blockchain.hash_block(block1)
  assert blockchain.chain == [block1, block2]
output: 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):
          import time
          return round(time.time() * 1000)
      def hash_block(self, block):
          import hashlib
          import json
          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