But there's naked truth, and there's narrative truth. In the latter, you own what you did wrong and explain why it won't happen again. (Because it won't - right?)
Reader 1 could say: "Although I did good work, I was late to work too often. Since then, I have developed better time management skills so my old habits no longer sabotage my otherwise strong performance."
Reader 2 could say: "My performance was strong, but I had a bad habit of using my cellphone when I wasn't helping customers, which was against company policy.
Now, I keep my phone switched off until I'm on my own time. Otherwise, my performance record should show that I'm a hard worker who delivers excellent service."
Practice in front of a friend or video camera until you master an honest, unflinching delivery. It's all right to look contrite, but don't grovel or ramble. Own it and move on.
Now try out your response on your former boss. Acknowledge that you understand why you had to be let go, and that it was the wake-up call you needed to make necessary changes. Ask if the boss is willing to share the positive things about your performance and character if contacted for a reference.
After that, keep your narrative in your back pocket until the situation calls for it. Ideally, you won't need to pull it out more than once for the rest of your life.
Karla L. Miller writes an advice column on navigating the modern workplace for the Washington Post.