def duplicate_check(file):
    """Checks the potfiles for duplicate lines/hashes"""
    seen = set()
    duplicates = 0
    try:
        with open(file, "r") as source:
            line = source.readline()
            while line is not '':
                if line in seen:
                    duplicates += 1
                else:
                    seen.add(line)
                line = source.readline()
    except FileNotFoundError:
        print("Potfile {} not found, could not check for duplicates".format(file))
        return 0

    return duplicates