text: from sklearn.pipeline import Pipeline
  
  
  def serialize_pipeline(model):
      from sklearn_json import serialize_model
      serialized_model = {
          'meta': 'pipeline',
          'steps': [(name, serialize_model(m)) for name, m in model.steps],
          'verbose': model.verbose,
          'memory': model.memory,
      }
  
      return serialized_model
  
  
  def deserialize_pipeline(model_dict):
      from sklearn_json import deserialize_model
  
      steps = [(name, deserialize_model(d)) for name, d in model_dict['steps']]
      model = Pipeline(
          steps=steps,
          memory=model_dict['memory'],
          verbose=model_dict['verbose'],
      )
  
      return model
  