input: Write a function to create a basic blockchain in Python using only the core modules. The function should initialize a blockchain, create blocks, and calculate the hash of a block. If the given blockchain is empty, return an empty blockchain.
  assert create_blockchain() == None
  assert create_blockchain().create_block(123, "0").get('block_number') == 1
  assert create_blockchain().hash_block({
   'block_number': 1,
   'timestamp': 1609459200000,
   'nonce': 123,
   'previous_hash': '0'
  }) == '0db5db4ccf40ef7ce7ee5c76d8704d1fc07c65ec32bbbdc4db0a3a5e3d541870'
output: def create_blockchain():
      class Blockchain:
          def __init__(self):
              self.chain = []
              self.current_block = None
  
          def create_block(self, nonce, previous_hash):
              if not self.chain:
                  block_number = 1
              else:
                  block_number = self.chain[-1]['block_number'] + 1
              block = {
                  'block_number': block_number,
                  'timestamp': int(time.time() * 1000),
                  'nonce': nonce,
                  'previous_hash': previous_hash
              }
              self.current_block = block
              self.chain.append(block)
              return block
  
          def hash_block(self, block):
              block_string = json.dumps(block, sort_keys=True).encode()
              return hashlib.sha256(block_string).hexdigest()
  
      if not Blockchain().chain:
          return None
      return Blockchain()