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: py_addpath.m
    path of file: ./repos/FMUT
    
    the code of the file until where you have to start completion: %Add directory to import search path for the instance of 
%the Python interpreter currently controlled by MATLAB
%
%EXAMPLE USAGE
% >> py_add
    
function is provided "as is" and any express or implied warranties 
%are disclaimed.

%Copyright (c) 2017, Eric Fields
%All rights reserved.
%This code is free and open source software made available under the 3-clause BSD license.

function new_py_path = py_addpath(directory, MATLAB_too)
    
    %check input
    if ~ischar(directory)
        error('Input must be a string')
    elseif ~exist(directory, 'dir') && ~isempty(directory)
        error('%s is not a valid directory', directory)
    end