An exhortation to being shrewd/cunning in a dangerous circumstance. Doesn't make serpents any special source of wisdom. Its like saying "you know how those two-legged snakes are when it comes to being mindful of their own interests or objectives...in this dangerous setting be shrewd and mindful as they are but yet be harmless as doves because they will set out to turn any and everything against you."...for the children of this world are in their generation wiser than the children of light.
Wisdom and light are shed forth on both the just and the unjust.43 Ye have heard that it hath been said, Thou shalt love thy neighbour, and hate thine enemy.
44 But I say unto you, Love your enemies, bless them that curse you, do good to them that hate you, and pray for them which despitefully use you, and persecute you;
45 That ye may be the children of your Father which is in heaven: for he maketh his sun to rise on the evil and on the good, and sendeth rain on the just and on the unjust.