'test that a given list has no duplicates'

def _duplicate_test(self, namelist, listname):

    dupes = {}
    for name in set(namelist):
        cnt = namelist.count(name)
        if (cnt > 1):
            dupes[name] = cnt
    if dupes:
        self.fail(('The    following    names    occur    more    than    once    in    %s:    %s' % (listname, json.dumps(dupes, indent=2))))
