def create_session(self, lang='scala', properties=None):
    if not properties:
      config = DefaultConfiguration.objects.get_configuration_for_user(app='spark', user=self.user)
      if config is not None:
        properties = config.properties_list
      else:
        properties = self.get_properties()

    props = dict([(p['name'], p['value']) for p in properties]) if properties is not None else {}

    props['kind'] = lang

    api = get_spark_api(self.user)

    response = api.create_session(**props)

    status = api.get_session(response['id'])
    count = 0

    while status['state'] == 'starting' and count < 120:
      status = api.get_session(response['id'])
      count += 1
      time.sleep(1)

    if status['state'] != 'idle':
      info = '\n'.join(status['log']) if status['log'] else 'timeout'
      raise QueryError(info % _('The Spark session could not be created in the cluster: %s'))

    return {
        'type': lang,
        'id': response['id'],
        'properties': properties
    }
dataset/ETHPy150Open cloudera/hue/desktop/libs/notebook/src/notebook/connectors/spark_shell.py/SparkApi.create_session/swapped operands of `%`