In the process of completing: Designing, Running, and Analyzing Experiments by University of California San Diego but translating to Python rather than R. Maybe the code is useful for others too!