input: Write a function to create and manage a basic blockchain system in Python. The function should include the creation of a Block class, a Blockchain class, and should be capable of adding blocks to the chain and returning the entire blockchain in JSON format. For testing, assert statements should be provided to verify the functionality.
  
  def create_blockchain():
      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)
  
      return Blockchain()
  
  blockchain = create_blockchain()
  blockchain.add_block({"timestamp": "2023-10-01T12:00:00", "data": "First block"})
  blockchain.add_block({"timestamp": "2023-10-02T13:00:00", "data": "Second block"})
  assert blockchain.get_chain() == json.dumps([
      {"index": 0, "timestamp": "2023-10-01T12:00:00", "data": "First block", "previous_hash": None, "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"},
      {"index": 1, "timestamp": "2023-10-02T13:00:00", "data": "Second block", "previous_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "hash": "6d3f2c46b6c9a7c2a78e816e1b7598a6c1c62b2c1a5a7f2c3a7f3b3d3f3e3f3d"}
  ], indent=2)
  assert isinstance(blockchain, create_blockchain().__class__)
  assert len(blockchain.chain) == 2
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)