code: def _baseobjective_from_callable(self, func, objective_type=MinimizeModel):
          
          if isinstance(func, BaseObjective) or (hasattr(func, '__self__') and
                                                 isinstance(func.__self__, BaseObjective)):
              # The latter condition is added to make sure .eval_jacobian methods
              # are still considered correct, and not doubly wrapped.
              return func
          else:
              from .fit import CallableNumericalModel, BaseModel
              if isinstance(func, BaseModel):
                  model = func
              else:
                  # Minimize the provided custom objective instead. We therefore
                  # wrap it into a CallableNumericalModel, thats what they are for
                  y = sympy.Dummy()
                  model = CallableNumericalModel(
                      {y: func},
                      connectivity_mapping={y: set(self.parameters)}
                  )
              return objective_type(model,
                                    data={y: None for y in model.dependent_vars})
docs: symfit works with BaseObjective subclasses internally. If a custom
          objective is provided, we wrap it into a BaseObjective, MinimizeModel by
          default.
  
          :param func: Callable. If already an instance of BaseObjective, it is
              returned immediately. If not, it is turned into a BaseObjective of
              type ``objective_type``.
          :param objective_type:
          :return: