code: def combine_proximals(*factory_list):
      r
      def diag_op_factory(sigma):
          """Diagonal matrix of operators.
  
          Parameters
          ----------
          sigma : positive float or sequence of positive floats
              Step size parameter(s), if a sequence, the length must match
              the length of the ``factory_list``.
  
          Returns
          -------
          diag_op : `DiagonalOperator`
          """
          if np.isscalar(sigma):
              sigma = [sigma] * len(factory_list)
  
          return DiagonalOperator(
              *[factory(sigmai)
                for sigmai, factory in zip(sigma, factory_list)])
  
      return diag_op_factory
docs: r"""Combine proximal operators into a diagonal product space operator.
  
      This assumes the functional to be separable across variables in order to
      make use of the separable sum property of proximal operators.
  
      Parameters
      ----------
      factory_list : sequence of callables
          Proximal operator factories to be combined.
  
      Returns
      -------
      diag_op : function
          Returns a diagonal product space operator factory to be initialized
          with the same step size parameter
  
      Notes
      -----
      That two functionals :math:`F` and :math:`G` are separable across variables
      means that :math:`F((x, y)) = F(x)` and :math:`G((x, y)) = G(y)`, and in
      this case the proximal operator of the sum is given by
  
      .. math::
          \mathrm{prox}_{\sigma (F(x) + G(y))}(x, y) =
          (\mathrm{prox}_{\sigma F}(x), \mathrm{prox}_{\sigma G}(y)).