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: add.m
    path of file: ./repos/xolotl/@xolotl
    
    the code of the file until where you have to start completion: 
%              _       _   _
%   __  _____ | | ___ | |_| |
%   \ \/ / _ \| |/ _ \| __| |
%    >  < (_) | | (_) | |_| |
%   /_/\_\___/|_|\___/ \__|_|
%
% ### add
%
%
% **Syntax**
%
% ```matlab
% x.add('compartment','comp_name')
% x.add(compartment,'comp_name')
% x.add('compartment','comp_name',...)
% x.add(Compartment,'comp_name')
% ```
%
% **Description**
%
% Adds a
    
function add(self,obj_type, obj_name,varargin)


msg = ['You tried to add a compartment without a label, which is not allowed. Every compartment must be labeled. \n\n<a href="https://xolotl.readthedocs.io/en/master/reference/matlab/xolotl/#add">Click here to read the documentation on how to use this method</a>'];
corelib.assert(nargin > 2,'xolotl:add:no_label',msg)

msg = ['The name of the object you are trying to add must be a character vector. \n\n<a href="https://xolotl.readthedocs.io/en/master/reference/matlab/xolotl/#add">Click here to read the documentation on how to use this method</a>'];
corelib.assert(ischar(obj_name),'xolotl:add:name_type_mismatch',msg)

msg = ['Illegal compartment name: ' obj_name '\n\n<a href="https://xolotl.readthedocs.io/en/master/reference/matlab/xolotl/#add">Click here to read the documentation on how to use this method</a>'];
corelib.assert(self.checkCompartmentName(obj_name),'xolotl:add:illegal_name',msg)

if isa(obj_type,'cpplab')
	% we're adding a cpplab object
	% if so, then the convention is
	% self.add(obj, obj_name)


	msg = ['You are attempting to add a cpplab object to a xolotl object. To do so, the convention is "self.add(obj, obj_name)". \n\n<a href="https://xolotl.readthedocs.io/en/master/reference/matlab/xolotl/#add">Click here to read the documentation on how to use this method</a>'];

	corelib.assert(length(varargin) == 0,'xolotl:add:cpplab_object' ,msg)

	obj = obj_type;

else

	obj = cpplab(obj_type, varargin{:});

end