Here is how you can create an ML engine directly from Python code:

server.ml_engines.create(
       'ml_engine_name',
       'ml_engine_handler',
       connection_data={'<ml_engine_handler>_api_key': '111'}
   )