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: imresizemaxd.m
    path of file: ./repos/cnnimageretrieval/utils
    
    the code of the file until where you have to start completion: function im = imresizemaxd(im, sz, increase_allowed, method)
% IMRESIZEMAXD resizes image so that longer edge is maximum to the given size.
%   
%   IM = IMRESIZEMAXD(IM, SIZE)
%     Resize IM so that longer edge is maximum SIZE.

    
function im = imresizemaxd(im, sz, increase_allowed, method)
% IMRESIZEMAXD resizes image so that longer edge is maximum to the given size.
%   
%   IM = IMRESIZEMAXD(IM, SIZE)
%     Resize IM so that longer edge is maximum SIZE.
%
%   IM = IMRESIZEMAXD(IM, SIZE, INCREASE_ALLOWED, METHOD)
%     Resize IM so that longer edge is maximum SIZE.
%     INCREASE_ALLOWED defines if smaller images will be upscaled. Default is TRUE.
%     METHOD defined the MATLAB supported imresize method. Default is 'BICUBIC'.

	if ~exist('increase_allowed'), increase_allowed = 1; end