def unique(values):
    values = _ensure_arraylike(values)
    if is_extension_array_dtype(values):
        return values.unique()
    original = values
    htable, _, values, dtype, ndtype = _get_hashtable_algo(values)
    table = htable(len(values))
    uniques = table.unique(values)
    uniques = _reconstruct_data(uniques, dtype, original)
    return uniques