Implementation of the Luhn checksum algorithm, see http://en.wikipedia.org/wiki/Luhn_algorithm
First argument should be a number or a string composed of digits only. Second argument is optional. If second argument evaluates to true, the return value is the concatenation of the first argument and its Luhn checksum. Otherwise the return value is a boolean indicating if the first arguments checksum digit is valid.
@madrobby beat you to it: https://gist.github.com/976805