939.11 Unnecessary charge for confining prisoner not to be allowed.—No charge for rent of any house for confining a prisoner, or for guarding a prisoner, any longer than may be necessary for transferring such prisoner to jail or place of safekeeping, or during the session of court at which such prisoner shall be arraigned, or to which he or she may be brought for trial, shall be allowed against the state or county.