You can run:
print(d.lengthUnits())
print(d.lengthUnits())
after you have defined your ellipsoid to see what the units of measurement for length are. Using your example code above, it results in DistanceUnit.Meters
.
Ref: https://qgis.org/pyqgis/master/core/QgsDistanceArea.html