in reply to When should a wheel be reinvented
If it does what you want but can't modify it, you wrap it.
If it's a blackbox, you rewrite it if you have the resources. Blackboxes are dangerous.
If you have the source, you fix it unless it takes too long.
Bart: God, Schmod. I want my monkey-man.