https://github.com/HazyResearch/snorkel/blob/master/tutorials/workshop/Workshop_2_Writing_Labeling_Functions.ipynb