input: Write a function to create a basic blockchain system in Python. The function should define a `Block` class to represent each block in the blockchain and a `Blockchain` class to manage the chain of blocks. The `Blockchain` class should have methods to add a new block to the chain and to retrieve the entire chain in JSON format. Each block should contain an index, a timestamp, data, and a hash value derived from its content and the hash of the previous block.
  
  def create_blockchain():
      import hashlib
      import json
  
      # We will use SHA256 as our hashing function
      def sha256(data):
          hash_function = hashlib.sha256()
          hash_function.update(data.encode('utf-8'))
          return hash_function.hexdigest()
  
      # Create a class for each block
      class Block:
          def __init__(self, index, timestamp, data, previous_hash):
              self.index = index
              self.timestamp = timestamp
              self.data = data
              self.previous_hash = previous_hash
              self.hash = sha256(f'{self.index}{self.timestamp}{self.data}{self.previous_hash}')
  
      # Create a class for the blockchain
      class Blockchain:
          def __init__(self):
              self.chain = []
  
          def add_block(self, data):
              previous_hash = self.chain[-1].hash if len(self.chain) > 0 else None
              block = Block(len(self.chain), data['timestamp'], data['data'], previous_hash)
              self.chain.append(block)
  
          # This method will return the entire blockchain in JSON format
          def get_chain(self):
              return json.dumps([b.__dict__ for b in self.chain], indent=2)
  
  assert create_blockchain() is not None
  blockchain = create_blockchain()
  blockchain.add_block({'timestamp': '2023-10-01 12:00:00', 'data': 'Block 1'})
  blockchain.add_block({'timestamp': '2023-10-01 12:05:00', 'data': 'Block 2'})
  assert blockchain.get_chain().count('Block 1') == 1
  assert blockchain.get_chain().count('Block 2') == 1
  empty_blockchain = create_blockchain()
  assert empty_blockchain.get_chain() == '{}'
output: import hashlib
  import json
  
  def sha256(data):
      hash_function = hashlib.sha256()
      hash_function.update(data.encode('utf-8'))
      return hash_function.hexdigest()
  
  class Block:
      def __init__(self, index, timestamp, data, previous_hash):
          self.index = index
          self.timestamp = timestamp
          self.data = data
          self.previous_hash = previous_hash
          self.hash = sha256(f'{self.index}{self.timestamp}{self.data}{self.previous_hash}')
  
  class Blockchain:
      def __init__(self):
          self.chain = []
  
      def add_block(self, data):
          previous_hash = self.chain[-1].hash if len(self.chain) > 0 else None
          block = Block(len(self.chain), data['timestamp'], data['data'], previous_hash)
          self.chain.append(block)
  
      def get_chain(self):
          return json.dumps([b.__dict__ for b in self.chain], indent=2)