code: def get_run_status(jobs: List[Job]) -> JobStatus:
      job = jobs[0]
      if len(job.job_submissions) == 0:
          return JobStatus.SUBMITTED
      return job.job_submissions[-1].status
  
imports: import asyncio
  import itertools
  import math
  import uuid
  from datetime import timezone
  from typing import List, Optional
  from sqlalchemy import select, update
  from sqlalchemy.ext.asyncio import AsyncSession
  from sqlalchemy.orm import joinedload
  import dstack._internal.server.services.gateways
  import dstack._internal.utils.common
  from dstack._internal.core.errors import RepoDoesNotExistError, ServerClientError
  from dstack._internal.core.models.runs import Job, JobPlan, JobSpec, JobStatus, JobSubmission, Run, RunPlan, RunSpec
  from dstack._internal.core.models.users import GlobalRole
  from dstack._internal.server.models import JobModel, ProjectModel, RunModel, UserModel
  from dstack._internal.server.services import backends
  from dstack._internal.server.services import repos
  from dstack._internal.server.services.jobs import get_jobs_from_run_spec, job_model_to_job_submission, stop_job
  from dstack._internal.server.services.projects import list_project_models, list_user_project_models
  from dstack._internal.utils.random_names import generate_name
label_desc: Use image node_id 3 for calling a global function with example usage: get_run_status(jobs) and returns: job, JobStatus