docs: def parse_optimization_expression(obj, linear=True, quadratic=False, expression=None, **kwargs):
      """
      Function for parsing the expression of a Constraint or Objective object.
  
      Parameters
      ----------
      object: Constraint or Objective
          The optimization expression to be parsed
      linear: Boolean
          If True the expression will be assumed to be linear
      quadratic: Boolean
          If True the expression will be assumed to be quadratic
      expression: Sympy expression or None (optional)
          An expression can be passed explicitly to avoid getting the expression from the solver.
          If this is used then 'linear' or 'quadratic' should be True.
  
      If both linear and quadratic are False, the is_Linear and is_Quadratic methods will be used to determine how it should be parsed
  
      Returns
      ----------
      A tuple of (linear_coefficients, quadratic_coefficients)
          linear_coefficients is a dictionary of {variable: coefficient} pairs
          quadratic_coefficients is a dictionary of {frozenset(variables): coefficient} pairs
      """
      if expression is None:
          expression = obj.expression
  
      if not (linear or quadratic):
          if obj.is_Linear:
              linear = True
          elif obj.is_Quadratic:
              quadratic = True
          else:
              raise ValueError("Expression is not linear or quadratic. Other expressions are not currently supported.")
  
      assert linear or quadratic
  
      if quadratic:
          offset, linear_coefficients, quadratic_coefficients = _parse_quadratic_expression(expression, **kwargs)
      else:
          offset, linear_coefficients = _parse_linear_expression(expression, **kwargs)
          quadratic_coefficients = {}
  
      return offset, linear_coefficients, quadratic_coefficients