I am using the pgmpy package in python. I used the BayesianModelSampler class to sample from a BayesianModel that represents a joint distribution over multiple discrete variable