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: smooth_source.m
    path of file: ./repos/fecgsyn/subfunctions/data-generation/libs/fieldtrip/private
    
    the code of the file until where you have to start completion: function source = smooth_source(source, varargin)

%[SOURCE] = SMOOTH(SOURCE, VARARGIN)
%
% computes location specific 3D gaussian kernels based on a FWHM estimate
%  source should contain the fields 
%    fwhm, specifying for each voxel the FWHM of the smoothing kernel in the xyz-direction
%    pos,  allowing for the units to be correct
%
%  key-value pairs should contain
%    parameter = string, field to be used for the smoothing
%    maxdist   = scalar, maximum distance for filter kernel


    
function source = smooth_source(source, varargin)

%[SOURCE] = SMOOTH(SOURCE, VARARGIN)
%
% computes location specific 3D gaussian kernels based on a FWHM estimate
%  source should contain the fields 
%    fwhm, specifying for each voxel the FWHM of the smoothing kernel in the xyz-direction
%    pos,  allowing for the units to be correct
%
%  key-value pairs should contain
%    parameter = string, field to be used for the smoothing
%    maxdist   = scalar, maximum distance for filter kernel

source    = ft_datatype_source(source);

parameter = ft_getopt(varargin, 'parameter', 'all');
maxdist   = ft_getopt(varargin, 'maxdist', []);

if ischar(parameter) && strcmp(parameter, 'all')
  ft_error('not yet implemented');	
elseif ischar(parameter)
	parameter = {parameter};
end