code: def test_sample_size_exactly_k():
      seq = range(20)
      sut = db.from_sequence(seq, npartitions=3)
      li = list(random.sample(sut, k=2).compute())
      assert sut.map_partitions(len).compute() == (7, 7, 6)
      assert len(li) == 2
      assert all(i in seq for i in li)
      assert len(set(li)) == len(li)
  
imports: from __future__ import annotations
  import math
  import random
  import pytest
  import dask.bag
  from dask.bag import random
label_desc: Use image node_id 8 for calling a global function with example usage: test_sample_size_exactly_k() without return types