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: isavailable.m
    path of file: ./repos/prima/matlab/setup_tools
    
    the code of the file until where you have to start completion: function availability = isavailable(directory, precision_or_variant)
%ISAVAILABLE checks whether a precision or variant is available under `directory` for all the solvers
% returned by `all_solvers()`.
% N.B.: We assume that `default_precision` and `default_variant` (see below) are always available.

solver_list = all_solvers();

% N.B.: Do NOT call `all_precisions()` to decide `precision_list`! Because `isavailable` is called
% during the setup of the package (if `setup path` is called), when `all_precisions.m` does not exist.
% Indeed, `isavailable` is invoked by `create_all_precisions`, which will create `all_precisions.m`.
% The same for `variant_list`.
[precision_list, default_precision] = all_precisions_possible();
[variant_list, default_variant] = all_variants_possible();


callstack = dbstack;

    
function availability = isavailable(directory, precision_or_variant)
%ISAVAILABLE checks whether a precision or variant is available under `directory` for all the solvers
% returned by `all_solvers()`.
% N.B.: We assume that `default_precision` and `default_variant` (see below) are always available.

solver_list = all_solvers();

% N.B.: Do NOT call `all_precisions()` to decide `precision_list`! Because `isavailable` is called
% during the setup of the package (if `setup path` is called), when `all_precisions.m` does not exist.
% Indeed, `isavailable` is invoked by `create_all_precisions`, which will create `all_precisions.m`.
% The same for `variant_list`.
[precision_list, default_precision] = all_precisions_possible();
[variant_list, default_variant] = all_variants_possible();


callstack = dbstack;
funname = callstack(1).name; % Name of the current function
if nargin ~= 2 || ~ischarstr(directory) || ~ischarstr(precision_or_variant) || ...
        ~ismember(precision_or_variant, [precision_list, variant_list])
    % Private/unexpected error
    error(sprintf('%s:InvalidInput', funname), '%s: UNEXPECTED ERROR: invalid input received.', funname);
end