You can find various samples of character reference for court here: http://www.criminal-lawyers.com.au/courts/character-reference.
Note that although a character reference for court is addressed to a judge or magistrate, it is to be given to the person or to the lawyer of the person for whom you are writing the letter.