docs: def with_dependencies(cls, model_expr, dependency_model, **init_kwargs):
          """
          Initiate a model whose components depend on another model. For example::
  
              >>> x, y, z = variables('x, y, z')
              >>> dependency_model = Model({y: x**2})
              >>> model_dict = {z: y**2}
              >>> model = Model.with_dependencies(model_dict, dependency_model)
              >>> print(model)
              [y(x; ) = x**2,
               z(y; ) = y**2]
  
          :param model_expr: The ``Expr`` or mapping/iterable of ``Expr`` to be
              turned into a model.
          :param dependency_model: An instance of (a subclass of)
              :class:`~symfit.core.fit.BaseModel`, which contains components on
              which the argument ``model_expr`` depends.
          :param init_kwargs: Any kwargs to be passed on to the standard
              init method of this class.
          :return: A stand-alone :class:`~symfit.core.fit.BaseModel` subclass.
          """
          model = cls(model_expr, **init_kwargs)  # Initiate model instance.
          if any(var in dependency_model for var in model.independent_vars):
              # This model depends on the output of the dependency_model,
              # so we need to work those components into the model_dict.
              model_dict = model.model_dict.copy()
              # This is the case for BaseNumericalModel's
              connectivity_mapping = init_kwargs.get('connectivity_mapping',
                                                     model.connectivity_mapping)
              for var in model.independent_vars:
                  if var in dependency_model:
                      # Add this var and all its dependencies.
                      # Walk over all possible dependencies of this
                      # variable until we no longer have dependencies.
                      for symbol in dependency_model.ordered_symbols:
                          # Not everything in ordered_symbols is a key of
                          # model, think e.g. parameters
                          if symbol in dependency_model:
                              if symbol not in model_dict:
                                  model_dict[symbol] = dependency_model[symbol]
                                  connectivity_mapping[symbol] = dependency_model.connectivity_mapping[symbol]
                          if symbol == var:
                              break
              # connectivity_mapping in init_kwargs has been updated if it was
              # present, since python is pass by reference. If it wasn't present,
              # we are dealing with a type of model that will build its own
              # connectivity_mapping upon init.
              model = cls(model_dict, **init_kwargs)
          return model