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: mtimes.m
    path of file: ./repos/chebfun/@ballfun
    
    the code of the file until where you have to start completion: function h = mtimes(f, g)
%*   BALLFUN multiplication.
%   a*F and F*a multiplies the BALLFUN F by the scalar a.
%
% See also TIMES.

% Copyright 2018 by The University of Oxford and The Chebfun Developers.
% See http://www.chebfun.org/ for Chebfun information.

fIsBallfun = isa(f, 'ballfun');
gIsBallfun = isa(g, 'ballfun');
fIsBallfunv = isa(g, 'ballfunv');

if (fIsBallfun && isnumeric(g))
    h = ballfun(g*f.coeffs, 'coeffs');
elseif (isnumeric(f) && gIsBallfun)
    h = ballfun(f*g.coeffs, 'coeffs');
elseif (fIsBallfun && gIsBallfun)
    h = times(f,g);

    
function h = mtimes(f, g)
%*   BALLFUN multiplication.
%   a*F and F*a multiplies the BALLFUN F by the scalar a.
%
% See also TIMES.

% Copyright 2018 by The University of Oxford and The Chebfun Developers.
% See http://www.chebfun.org/ for Chebfun information.

fIsBallfun = isa(f, 'ballfun');
gIsBallfun = isa(g, 'ballfun');
fIsBallfunv = isa(g, 'ballfunv');

if (fIsBallfun && isnumeric(g))
    h = ballfun(g*f.coeffs, 'coeffs');
elseif (isnumeric(f) && gIsBallfun)
    h = ballfun(f*g.coeffs, 'coeffs');
elseif (fIsBallfun && gIsBallfun)
    h = times(f,g);
elseif fIsBallfunv
    h = mtimes(g, f);
else
    error('BALLFUN:mtimes:unknown', ...
          ['Undefined function ''mtimes'' for input arguments of type ' ...
           '%s and %s.'], class(f), class(g));
end