Mention somewhere in the docstring and/or the inline comments that it tries to avoid duplicates.