code: def scipy_constraints(self, constraints):
          
          cons = []
          types = {  # scipy only distinguishes two types of constraint.
              sympy.Eq: 'eq', sympy.Ge: 'ineq',
          }
  
          for constraint in constraints:
              if isinstance(constraint, MinimizeModel):
                  # Typically the case when called by `Fit
                  constraint_type = constraint.model.constraint_type
              elif hasattr(constraint, 'constraint_type'):
                  # Model object, not provided by `Fit`. Do the best we can.
                  if self.parameters != constraint.params:
                      raise AssertionError('The constraint should accept the same'
                                           ' parameters as used for the fit.')
                  constraint_type = constraint.constraint_type
                  constraint = MinimizeModel(constraint, data=self.objective.data)
              elif isinstance(constraint, sympy.Rel):
                  constraint_type = constraint.__class__
                  constraint = self.objective.model.__class__.as_constraint(
                      constraint, self.objective.model
                  )
                  constraint = MinimizeModel(constraint, data=self.objective.data)
              else:
                  raise TypeError('Unknown type for a constraint.')
              con = {
                  'type': types[constraint_type],
                  'fun': constraint,
                  }
              cons.append(con)
          cons = tuple(cons)
          return cons
docs: Returns all constraints in a scipy compatible format.
  
          :param constraints: List of either MinimizeModel instances (this is what
            is provided by :class:`~symfit.core.fit.Fit`),
            :class:`~symfit.core.fit.BaseModel`, or
            :class:`sympy.core.relational.Relational`.
          :return: dict of scipy compatible statements.