code: def save_kb_dyn_config(kb_id, field, expression, collection=None):
      
      # check that collection exists
      if collection:
          collection = Collection.query.filter_by(name=collection).one()
  
      kb = get_kb_by_id(kb_id)
      kb.set_dyn_config(field, expression, collection)
docs: Save a dynamic knowledge base configuration.
  
      :param kb_id: the id
      :param field: the field where values are extracted
      :param expression: ..using this expression
      :param collection: ..in a certain collection (default is all)