def deploy(self, version_name, path, runtime_version=None):
    """Deploy a model version to the cloud.

    Args:
      version_name: the name of the version in short form, such as "v1".
      path: the Google Cloud Storage path (gs://...) which contains the model files.
      runtime_version: the ML Engine runtime version as a string, example '1.2'.
          See https://cloud.google.com/ml-engine/docs/concepts/runtime-version-list
          for a list of runtimes. If None, the ML Engine service will pick one.

    Raises: Exception if the path is invalid or does not contain expected files.
            Exception if the service returns invalid response.
    """
    if not path.startswith('gs://'):
      raise Exception('Invalid path. Only Google Cloud Storage path (gs://...) is accepted.')

    # If there is no "export.meta" or"saved_model.pb" under path but there is
    # path/model/export.meta or path/model/saved_model.pb, then append /model to the path.
    if not datalab.storage.Object.from_url(os.path.join(path, 'export.meta')).exists() and not \
            datalab.storage.Object.from_url(os.path.join(path, 'saved_model.pb')).exists():
      if datalab.storage.Object.from_url(os.path.join(path, 'model', 'export.meta')).exists() or \
              datalab.storage.Object.from_url(os.path.join(path, 'model',
                                                           'saved_model.pb')).exists():
        path = os.path.join(path, 'model')
      else:
        print('Cannot find export.meta or saved_model.pb, but continue with deployment anyway.')

    body = {'name': self._model_name}
    parent = 'projects/' + self._project_id
    try:
      self._api.projects().models().create(body=body, parent=parent).execute()
    except:
      # Trying to create an already existing model gets an error. Ignore it.
      pass
    body = {
      'name': version_name,
      'deployment_uri': path,
    }

    if runtime_version:
      body['runtime_version'] = runtime_version

    response = self._api.projects().models().versions().create(
      body=body, parent=self._full_model_name).execute()
    if 'name' not in response:
      raise Exception('Invalid response from service. "name" is not found.')
    _util.wait_for_long_running_operation(response['name'])
Deploy a model version to the cloud.

    Args:
      version_name: the name of the version in short form, such as "v1".
      path: the Google Cloud Storage path (gs://...) which contains the model files.
      runtime_version: the ML Engine runtime version as a string, example '1.2'.
          See https://cloud.google.com/ml-engine/docs/concepts/runtime-version-list
          for a list of runtimes. If None, the ML Engine service will pick one.

    Raises: Exception if the path is invalid or does not contain expected files.
            Exception if the service returns invalid response.