You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: make_siamese.m
    path of file: ./repos/siamese-fc/util
    
    the code of the file until where you have to start completion: function net = make_siamese(stream1, stream2, join, final, inputs, output, varargin)
% Constructs a Siamese network of two stream nets joined by the join and
% then followed by the final net.
% The stream and final nets can be simple or DAG.
% They should have one input and one output.
% The two streams should be identical except for parameter values.
% The join net is a DAG with 2 inputs and 1 output.
% The inputs must be named 'in1' and 'in2'.
% The inputs and output parameters are the variable names for the resulting net.
% The input names is a cell-arra
    
function add_branches(net, stream1, stream2, inputs, outputs, share_inds)
% share_inds is a list of params to share.

    % Assume that both streams have the same names.
    orig_input = only(stream1.getInputs());
    orig_output = only(stream1.getOutputs());
    % Convert param indices to names.
    share_names = arrayfun(@(l) l.name, stream1.params(share_inds), ...
                           'UniformOutput', false);

    rename_unique1 = @(s) ['br1_', s];
    rename_unique2 = @(s) ['br2_', s];
    rename_common = @(s) ['br_', s];
    rename1 = struct(...
        'layer', rename_unique1, ...
        'var', rename_unique1, ...
        'param', @(s) rename_pred(s, @(x) ismember(x, share_names), ...
                                  rename_common, rename_unique1));
    rename2 = struct(...
        'layer', rename_unique2, ...
        'var', rename_unique2, ...
        'param', @(s) rename_pred(s, @(x) ismember(x, share_names), ...
                                  rename_common, rename_unique2));

    add_dag_to_dag(net, stream1, rename1);
    % Values of shared params will be taken from stream2
    % since add_dag_to_dag over-writes existing parameters.
    add_dag_to_dag(net, stream2, rename2);
    net.renameVar(rename_unique1(orig_input), inputs{1});
    net.renameVar(rename_unique2(orig_input), inputs{2});
    net.renameVar(rename_unique1(orig_output), outputs{1});
    net.renameVar(rename_unique2(orig_output), outputs{2});
end