code: def create_session(
          self,
          kind: SessionKind,
          proxy_user: str = None,
          jars: List[str] = None,
          py_files: List[str] = None,
          files: List[str] = None,
          driver_memory: str = None,
          driver_cores: int = None,
          executor_memory: str = None,
          executor_cores: int = None,
          num_executors: int = None,
          archives: List[str] = None,
          queue: str = None,
          name: str = None,
          spark_conf: Dict[str, Any] = None,
      ) -> Session:
          if self.legacy_server():
              valid_kinds = VALID_LEGACY_SESSION_KINDS
          else:
              valid_kinds = VALID_SESSION_KINDS
          if kind not in valid_kinds:
              raise ValueError(
                  f"{kind} is not a valid session kind for a Livy server of "
                  f"this version (should be one of {valid_kinds})"
              )
          body = {"kind": kind.value}
          if proxy_user is not None:
              body["proxyUser"] = proxy_user
          if jars is not None:
              body["jars"] = jars
          if py_files is not None:
              body["pyFiles"] = py_files
          if files is not None:
              body["files"] = files
          if driver_memory is not None:
              body["driverMemory"] = driver_memory
          if driver_cores is not None:
              body["driverCores"] = driver_cores
          if executor_memory is not None:
              body["executorMemory"] = executor_memory
          if executor_cores is not None:
              body["executorCores"] = executor_cores
          if num_executors is not None:
              body["numExecutors"] = num_executors
          if archives is not None:
              body["archives"] = archives
          if queue is not None:
              body["queue"] = queue
          if name is not None:
              body["name"] = name
          if spark_conf is not None:
              body["conf"] = spark_conf
          data = self._client.post("/sessions", data=body)
          return Session.from_json(data)