Easier to show than to tell you.

Perry Mason (1957-1966): The show had a reputation among writers as The Hardest Gig In Hollywood. After being infuriated by studios' treatment of his attorney/detective in 1940s B films, Earl Stanley Gardener wouldn't give up his creation to TV until he had a rock solid contract that guaranteed him script-approval. Every polished script was only a penultimate draft. It next had to endure Gardener's withering scrutiny to ensure accuracy of legal procedure. He frequently ripped the guts out of scripts whose plots depended on things that would not work in a court.

Was it 100% real-life? Nah. Was it as close as it could get? Probably.