Code clean-up for Python API.
Code clean-up for Python API.