Vertex color to wire color

Hi, can anyone help me write a script which changes an objects wire color to the object's average vertex color. thanks!