Pennsylvania Attorney General Kathleen Kane faces up to seven years in jail after being convicted of perjury in a politically charged trial. The Democrat was convicted on 9 counts of leaking grand jury information to a reporter to embarrass rival prosecutor Frank Fina. (Reuters)

Update: Pennsylvania's former attorney general, Kathleen Kane, was sentenced to 10-23 months in jail Monday for related to leaking grand jury information to the media then lying about it. Here, from the summer, is a rundown of what led to this moment:

The story reads like a screenplay: the scandalous, pornographic emails. The leaked grand jury documents. The undercover investigations. The political rivalries being played out in the news media. The allegations of sexism. And most of all, the stunning fall from grace. Of course, it isn't fiction — this is Pennsylvania attorney general Kathleen Kane's story. Or, former attorney general, as of Aug. 16:

In 2012, Kane was the first Democrat to be elected as the state's top prosecutor, a rising star in the party who very likely had ambitions for even higher office. On Monday, she was sentenced in jail for 10 to 23 months after she was convicted of nine different criminal charges related to leaking grand jury information to the news media and then lying about it. Gov. Tom Wolf, a Democrat, has urged her to "resign immediately," and she did.

It's a case that is fascinating, and complicated — and one that underscores Pennsylvania's penchant for scandal.

Here's what happened:

It all started with Jerry Sandusky

Sandusky is the former Penn State assistant football coach accused of sexual abuse. When Kane ran for the attorney general position in 2012, she promised to investigate the former governor's handling of the scandal. (An earlier state investigation found former GOP governor Tom Corbett did nothing wrong.)

Kane didn't find a smoking gun, but in the process, her team uncovered thousands of emails showing state officials trading pornographic, racist and misogynistic messages. Many of them are incredibly lewd. Writing for The Washington Post in December, Natalie Pompilio describes a few:

A photo of a pantsless woman on her knees performing oral sex on a man is captioned “Making your boss happy is your only job.” A picture of a white man fending off two African American men while carrying a bucket of fried chicken reads “BRAVERY At Its Finest.” The sender of the email that shows a group of men engaged in sex included this message to friends, “How friggin gay are you?”

The Porngate scandal was a who's who list in Pennsylvania state politics. Two state Supreme Court justices were caught in the scandal and lost their jobs. Kane's twin sister, an aide in her office, also had sent some of these emails.

Also caught in the scandal was a guy named Frank Fina, a state prosecutor who was critical of Kane's decision to try to reinvestigate his former boss, Corbett. Fina probably would have flown under the radar this entire time were it not for his political rivalry with Kane.

This, Kane has said, is where her trouble begins.

To know this case is to know Kane's political rivalry

Actually, let's back up even further. Shortly after Kane took office in 2013, she decided to shut down an undercover corruption investigation against four Democratic Philadelphia-area state lawmakers and a traffic court judge who were caught accepting cash and gifts from a lobbyist.

The prosecutor running that investigation for the past three years was none other than Fina, who ran the attorney general's public corruption unit under Corbett.

This was all playing out behind the scenes until news leaked that Kane wasn't going to pursue corruption charges against some in her own party. The leak came from Kane's office. She blamed Fina for the breach and told the public by way of explanation that she thought the corruption case targeted African Americans and was poorly managed.

In Kane's mind, we'd later find out, this was just one more example of the old boys club going after her for trying to clean them up.

Another leaked investigation, charges against Kane

Then, in 2014, there was another leak on what seemed like a totally unrelated case. The Philadelphia Daily News got hold of a memo from a 2009 secret grand jury investigation into a former NAACP leader that never went anywhere.

This time, the leak was potentially damning for Fina, who had decided not to prosecute the local official despite questions about the Philadelphia chapter's use of funds.

Kane's defense lawyer would later say she wanted those documents to be public to show Fina's decision not to prosecute but that she didn't release them herself.

But leaking grand jury information is worthy of its own grand jury investigation. State officials launched one of their own into who was behind the leak, and they pointed the finger at Kane. In January 2015, the grand jury recommended Kane face charges of perjury and abusing the authority of her office as well as making a false statement to the jury.

She maintained her innocence: "I told the people of Pennsylvania I would fight public corruption, and that is exactly what this is. The court systems are being used to overturn an election of somebody they just don't like," she said at a news conference (unrelated to the charges) at the time, reported the Morning Call.

Kane's trial turns into a blame game

Officials decided to press charges against Kane, and the trial played out over the past few weeks. That's where much of this dirty laundry was aired.

Kane's defense team argued that it was her top aide, Adrian King, who abused his power when he sent the grand jury information to a reporter.

But a political consultant, Josh Marrow, testified under immunity that it was Kane. Morrow said he and Kane created a coverup story to frame King as the one who leaked the information. He acknowledged telling a lie to the grand jury, according to the Associated Press:

"'She was just hell-bent on getting back at Frank Fina,' Morrow testified, describing Kane as 'unhinged' at the time."

Kane's team didn't call any witnesses to her defense. Instead, her defense attorney tried to disparage her former allies after they testified against her.

"Those are two witnesses who will say whatever they need to in order to protect themselves,” defense attorney Seth Farber said, according to the New York Times.“You would not even buy a used car from one of them.”

Who's the hero here?

The jury ended up finding Kane guilty on all nine charges, including a perjury charge that can bring up to seven years in prison.

Kane's defense team still maintains her innocence. They say they weren't allowed to talk about those lewd emails we described at the top of this story, which would have helped her make her case that she was the one on the receiving end of political retribution.

If you're still scratching your head to make sense of it all, know that people who have been covering this case for a while now are, too. One of the things that makes this case so difficult to grasp is how hard it is to separate the creeps from the heroes, noted Pompilio in The Post in December.

From the very beginning, this whole sordid drama has wrapped up the good guys (depending on your political affiliation and allegiances), the bad guys and nearly everyone in between. It's felled two state Supreme Court justices and one of the Pennsylvania Democratic Party's rising stars.

And in a state known for political scandal, this will probably go down as one of the most twisted, surprising — and, frankly, complicated — in recent memory.