Figuring out how to render depth images

Hey all! I’m working on a pretty simple script to allow me to render depth images of several OBJ models from varying camera angles. So far I’ve been able to come up with a script (based off of a whole bunch of other GitHub code I’ve been able to find) as follows that sets up an orthographic camera and light and renders viewpoints by rotating the camera around the z-axis. Here’s that code:

What I’m interested in doing with this script now is rendering solely depth images. I’m pretty new to Blender and scripting in Blender so I’m not sure how to go about doing this and would appreciate any suggestions! I’ve been looking at some code from this repo, but it’s for Blender 2.79 but I’m not sure if it’ll carry over to the newer 2.8+ versions, or if it’ll carry over the same way with the code that I have.