Kanye West was just ordered to stay 10 yards away from the photog he attacked at LAX, but prosecutors got shut down when they asked that Kanye attend anger management classes ... TMZ has learned.
Blair Berk -- considered one the most effective criminal defense lawyers in the country who reps tons of celebs -- appeared in court on Kanye's behalf to ask the judge to make prosecutors fork over all of the info they have in their criminal battery case.
The judge ordered that the info be turned over, and then told prosecutors they should advise the photog -- Daniel Ramos -- to also stay away from Kanye. The judge said everyone involved should NOT use "self-help" -- aka, inciting and ass-whooping.
But then ... prosecutors asked the judge to order Kanye to attend anger management classes as a condition of bail. The judge scoffed, and rejected the request.
Berk is an interesting selection for Kanye because she's known for getting things done under the radar ... something foreign to his baby mama and her relatives.
Kanye needs a Houdini because sources tell us prosecutors have 7 videos showing the attack from virtually every angle.
As far as lawyers who are up to the task ... he chose right.