I caught a lv29 Ditto with 84.4% IV's this morning, so not perfect, but pretty good - not completely removed from typical gym attackers.
My experiments:
As an attacker it took the form of what I would estimate to be a lv20 Kingler but with lv29 cp and easily beat him but not quite as easily as I would have expected given the lvl difference. The problem comes when the next defender pops up - you're still stuck as a Kingler... I got through two levels but only just.
As a defender:
I tried attacking him with various Pokes with very mixed results. Whilst the transform is happening you can inflict a lot of damage if your attack is fairly fast (e.g. Gyrados bite). He almost survived an attack by a lvl 22 Gyrados and with better dodging probably would have scraped through.
I tried a Lvl21 Golem and he won that with a bit of health to survive, but generally he was either just beaten or just barely survived attacks by level 20 Pokes.
Effectively I would say despite the supposed CP his performance was more like 10 levels down.
Will I power mine up to Lvl 30? I'm undecided - I've got the candy if I sacrifice my 70cp Ditto but it's 10,000 stardust on what's only slightly better than a novelty.