def duplicates(anylist):
    """Returns a list of the duplicate values contained in a list
    A common and more concise way of doing this works well for small lists:

        return list(set([value for value in anylist if anylist.count(value) > 1]))

    However it is O(n^s) complexity whereas this is O(n) complexity, and thus
    suitable even for large lists; as it will traverse the list only once.
    """
    if not isinstance(anylist, list):
        raise ValueError(
            "duplicates expected a list, got {}\n{}".format(type(anylist), anylist)
        )
    seen = set()
    dups = set()
    for value in anylist:
        if value in seen:
            dups.add(value)
        else:
            seen.add(value)
    return list(dups)