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: find_mpe.m
    path of file: ./repos/bnt/BNT/inference/static/@global_joint_inf_engine
    
    the code of the file until where you have to start completion: function [mpe, ll] = find_mpe(engine, evidence)
% FIND_MPE_GLOBAL Compute the most probable explanation(s) from the global joint
% [mpe, ll] = find_mpe(engine, evidence)
%
% mpe(k,i) is the most probable value of node i in the k'th global mode  (cell array)
%
% We assume all nodes are discrete

%engine = global_joint_inf_engine(bnet);
bnet = bnet_from_engine(engine);
engine = enter_evidence(engine, evidence);
S1 = struct(engine); % violate object privacy
S2 = struct(S1.jpot); % joint potential
prob = max(S2.T(:));

    
function [mpe, ll] = find_mpe(engine, evidence)
% FIND_MPE_GLOBAL Compute the most probable explanation(s) from the global joint
% [mpe, ll] = find_mpe(engine, evidence)
%
% mpe(k,i) is the most probable value of node i in the k'th global mode  (cell array)
%
% We assume all nodes are discrete

%engine = global_joint_inf_engine(bnet);
bnet = bnet_from_engine(engine);
engine = enter_evidence(engine, evidence);
S1 = struct(engine); % violate object privacy
S2 = struct(S1.jpot); % joint potential
prob = max(S2.T(:));
modes = find(S2.T(:) == prob);

ens = bnet.node_sizes;
onodes = find(~isemptycell(evidence));
ens(onodes) = 1;
mpe = ind2subv(ens, modes);
for k=1:length(modes)
  for i=onodes(:)'
    mpe(k,i) = evidence{i};
  end