This is much closer to the Python API for this same function