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: setupCDSAPIIfNeeded.m
    path of file: ./repos/climatedatastore/toolbox/internal
    
    the code of the file until where you have to start completion: function setupCDSAPIIfNeeded(promptForCredentials)
%SETUPCDSAPIIFNEEDED Install CSAPI module if it is not installed. Get credentials if no .cdsapirc file does not exist. Visit
%https://cds.climate.copernicus.eu/api-how-to for more info on credentials.

% Copyright 2021-2022 The MathWorks, Inc.

arguments
    promptForCredentials (1,1) logical = true;
end
    pythonInfo = pyenv;
    
    if pythonInfo.Version == ""
        % Python not set up
        error("climateDataStore:pythonNotInstalled","Python not installed.")
    end

    % Call PIP to see if cdsapi is installed
    [result, ~]  = system(fullfile(pythonInfo.Home,"Scripts","pip3")+" show cdsapi");
    if result ~= 0

    
function setupCDSAPIIfNeeded(promptForCredentials)
%SETUPCDSAPIIFNEEDED Install CSAPI module if it is not installed. Get credentials if no .cdsapirc file does not exist. Visit
%https://cds.climate.copernicus.eu/api-how-to for more info on credentials.

% Copyright 2021-2022 The MathWorks, Inc.

arguments
    promptForCredentials (1,1) logical = true;
end
    pythonInfo = pyenv;
    
    if pythonInfo.Version == ""
        % Python not set up
        error("climateDataStore:pythonNotInstalled","Python not installed.")
    end

    % Call PIP to see if cdsapi is installed
    [result, ~]  = system(fullfile(pythonInfo.Home,"Scripts","pip3")+" show cdsapi");
    if result ~= 0
        % it's not installed
        [result, ~]  = system(fullfile(pythonInfo.Home,"Scripts","pip3")+" install cdsapi");
        if result ~= 0
            error("climateDataStore:unableToInstallCSAPI","Could not use PIP3 to install CDSAPI")
        end