Writing a court character reference

I have a friend who is to undergo a criminal trial this month, and I’ve been asked me to write a character refererence on his behalf.

Has anyone else written one of these? Should it be in the form of a letter, or some other kind of format? To make it admissable in court, does it have to be hard-copy and signed, or would a fax or email suffice? Any advice as to the tone, or the kind of information to be included?

Thanks.

Years ago a boss asked me to write one of those on behalf of a young man working with me. He was out of jail on probation or bail for some kind of unsettled legal case and his lawyer thought a letter to the judge saying he was honest, dependable, and a good worker would help him.
Since he was an asset to the job and I didn’t need to lie, I wrote a glowing letter ‘To whom it may concern’ about his character and work habits on the job and gave it to my boss, who passed it on. It must have worked since he continued to work with me.
I wrote the letter just like I would write to a friend, closed with my name, position and company name.