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: scn_spm_design_check.m
    path of file: ./repos/CanlabCore/CanlabCore/diagnostics
    
    the code of the file until where you have to start completion: function out = scn_spm_design_check(spm_results_dir, varargin)
% Run in a single-subject (first-level) SPM directory to check 
% design matrix variance inflation factors and high-pass filtering.
% Prints out table of regressors and their above-threshold VIFs (see options).
% Saves .png images of the key figures.
%
% :Usage:
% ::

    
function out = scn_spm_design_check(spm_results_dir, varargin)
% Run in a single-subject (first-level) SPM directory to check 
% design matrix variance inflation factors and high-pass filtering.
% Prints out table of regressors and their above-threshold VIFs (see options).
% Saves .png images of the key figures.
%
% :Usage:
% ::
%
%     scn_spm_design_check(spm_results_dir, varargin)
%
% :Optional Inputs:
%
%   **'events_only':**
%        Show plots and diagnostics for ONLY events, not nuisance covariates or
%        other user-specified regressors.  Useful when you have many nuisance
%        covs.
%
%   **'from_multireg':*** % edit lukasvo76
%        followed by an integer, to include first n columns from
%        the multireg R matrix as "of interest".  only works with 'events_only'
%        flag, of course.
%        gets passed on to scn_spm_events_of_interest
%
%   **'vif_thresh', t':**
%        Only regressors with a VIF > t will be printed in VIF table.
%
%   **'sort_by_vif'':**
%        Sort regressors in VIF table by VIF (DEFAULT: order regressors as in model).   
%
% Note: full design VIFs are computed using filtered design matrices to
% inform first level analysis beta's. 'events only' output uses unfiltered 
% design matrices to inform the study design.
%
% Calls: scn_spm_choose_hpfilter.m, scn_spm_get_events_of_interest.m
%
% :Examples:
% ::
%
%    scn_spm_design_check(pwd, 'events_only');
%
% ..
%    Updated: Tor Wager, Aug 2010; Oct 2011: Add 'events_only'; July 2012:
%    fixed for parametric modulators. Luka Ruzic, Sept 2012: added VIF tables.
%    Wani Woo, Apr, 2018: added an output (out) to return vif values 
%    Lukas Van Oudenhove, March, 2022: added 'from_multireg' option which
%    was already implemented in scn_spm_get_events_of_interest
% ..


if nargin < 1, spm_results_dir = pwd; end