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: trnorm.m
    path of file: ./repos/Robotics-Toolbox/rvctools/release10.3.1/robot
    
    the code of the file until where you have to start completion: %TRNORM Normalize a rotation matrix
%
% RN = TRNORM(R) is guaranteed to be a proper orthogonal matrix rotation
% matrix (3x3) which is "close" to 
    
function TR = trnorm(T)

    assert(ishomog(T) || isrot(T), 'RTB:trnorm:badarg', 'expecting 3x3xN or 4x4xN hom xform');
    
    if ndims(T) == 3
        % recurse for transform sequence
        nd = size(T, 3);
        r = zeros(4,4,nd);
        for i=1:nd
            TR(:,:,i) = trnorm(T(:,:,i));
        end