Correct error in Python bindings that prevented use of custom profile.
(cherry picked from commit 5774843c1157e488074ece29b5bc0977608457db)