You divided your data set into a class. After that, you take a sample from each subgroup independently. The number of copies that you select from one subgroup should be proportional to its share.
data
d(i) <- { x in data | class(x) =i }
for each class
for j = 0..samplesize*(size(d(i))/size(data))
sample(i) <- draw element from d(i)
sample <- U sample(i)
{'a', 'a', 'a', 'a', 'a', 'a', 'b', 'b'}
, , b
.