code: def sum(*summands, id=None, lazy=True):
      r"""Construct an operator which is the sum of the given operators.
  
      Args:
          *summands (tuple[~.operation.Operator]): the operators we want to sum together.
  
      Keyword Args:
          id (str or None): id for the Sum operator. Default is None.
          lazy=True (bool): If ``lazy=False``, a simplification will be performed such that when any
              of the operators is already a sum operator, its operands (summands) will be used instead.
  
      Returns:
          ~ops.op_math.Sum: The operator representing the sum of summands.
  
      .. note::
  
          This operator supports batched operands:
  
          >>> op = qml.sum(qml.RX(np.array([1, 2, 3]), wires=0), qml.PauliX(1))
          >>> op.matrix().shape
          (3, 4, 4)
  
          But it doesn't support batching of operators:
  
          >>> op = qml.sum(np.array([qml.RX(0.4, 0), qml.RZ(0.3, 0)]), qml.PauliZ(0))
          AttributeError: 'numpy.ndarray' object has no attribute 'wires'
  
      .. seealso:: :class:`~.ops.op_math.Sum`
  
      **Example**
  
      >>> summed_op = qml.sum(qml.PauliX(0), qml.PauliZ(0))
      >>> summed_op
      PauliX(wires=[0]) + PauliZ(wires=[0])
      >>> summed_op.matrix()
      array([[ 1,  1],
             [ 1, -1]])
      """
      if lazy:
          return Sum(*summands, id=id)
  
      summands_simp = Sum(
          *itertools.chain.from_iterable(
              [op if isinstance(op, Sum) else [op] for op in summands]
          ),
          id=id,
      )
  
      for op in summands:
          QueuingManager.remove(op)
  
      return summands_simp
  
imports: import itertools
  from copy import copy
  from typing import List
  import numpy
  import pennylane
  from pennylane import math
  from pennylane.operation import Operator
  from pennylane.ops.qubit import Hamiltonian
  from pennylane.queuing import QueuingManager
  from .composite import CompositeOp
label_desc: Use image node_id 1 for calling a global function with example usage: sum() and returns: summands_simp, Sum