code: def create_multi_output_factor(self, tool, source, splitting_node, sink):
          if source and not isinstance(source, Node):
              raise ValueError("Expected Node, got {}".format(type(source)))
          if not isinstance(sink, Node):
              raise ValueError("Expected Node, got {}".format(type(sink)))
          if not isinstance(tool, MultiOutputTool):
              raise ValueError("Expected MultiOutputTool, got {}".format(type(tool)))
          input_plates = source.plates if source else []
          output_plates = sink.plates
          if len(input_plates) > 1:
              raise NotImplementedError
          if len(output_plates) == 0:
              raise ValueError("No output plate found")
          if len(output_plates) == 1:
              if not self.check_multi_output_plate_compatibility(input_plates, output_plates[0]):
                  raise IncompatiblePlatesError("Parent plate does not match input plate")
              factor = MultiOutputFactor(tool=tool, source_node=source, splitting_node=splitting_node, sink_node=sink,
                                         input_plate=input_plates[0] if input_plates else None,
                                         output_plates=output_plates[0])
          else:
              if len(output_plates) > 2:
                  raise NotImplementedError
              if len(input_plates) != 1:
                  raise IncompatiblePlatesError("Require an input plate to match all but one of the output plates")
              if output_plates[0] == input_plates[0]:
                  output_plate = output_plates[1]
              else:
                  if output_plates[1].plate_id != input_plates[0].plate_id:
                      raise IncompatiblePlatesError("Require an input plate to match all but one of the output plates")
                  output_plate = output_plates[0]
                  output_plates[1], output_plates[0] = output_plates[0], output_plates[1]
              if not output_plate.is_root:
                  match = False
                  parent = input_plates[0].parent
                  while parent is not None:
                      if parent.plate_id == output_plate.parent.plate_id:
                          match = True
                          break
                      parent = parent.parent
                  if not match:
                      raise IncompatiblePlatesError("Require an input plate to match all but one of the output plates")
              factor = MultiOutputFactor(
                  tool=tool, source_node=source, sink_node=sink,
                  splitting_node=splitting_node, input_plate=input_plates[0], output_plates=output_plates)
          self._add_factor(factor)
          return factor