I flagged this question as off-topic because it was a code-writing request.
The question itself has -8 net downvotes and doesn't show any research or an attempt at a solution. The flag was declined... I'm not sure why, since it certainly appears a though the community regards this as a non-productive question.