I think adding a comment mentionning the source of the function and how it was called there should suffice, and is in fact necessary to acknowledge authorship.