code: def _weighted_sum(model, values, weight, output_name):
      values_weights = zip(values, [weight] * len(values))
      values_weights_flattened = [
          x for v_w in values_weights for x in v_w
      ]
      return model.net.WeightedSum(
          values_weights_flattened,
          output_name,
      )
  
imports: from abc import ABCMeta, abstractmethod
  import argparse
  import logging
  import numpy
  import sys
  from caffe2.python import core, rnn_cell, workspace
  from caffe2.python.models.seq2seq.beam_search import BeamSearchForwardOnly
  from caffe2.python.models.seq2seq.seq2seq_model_helper import Seq2SeqModelHelper
  import caffe2.python.models.seq2seq.seq2seq_util
label_desc: Use image node_id 1 for calling a global function with example usage: _weighted_sum(model, values, weight, output_name) and returns: model