code: def get_revision(dataset: str) -> Optional[str]:
      cache_kinds = [
          processing_step.cache_kind
          for processing_step in processing_graph.get_first_processing_steps()
      ]
      cache_entries = get_cache_entries_df(
          dataset=dataset,
          cache_kinds=cache_kinds,
      ).to_dict(orient="list")
      if cache_entries.get("dataset_git_revision") and isinstance(
          revision := cache_entries["dataset_git_revision"][0], str
      ):
          return revision
      job_types = [
          processing_step.job_type
          for processing_step in processing_graph.get_first_processing_steps()
      ]
      pending_jobs = (
          Queue()
          .get_pending_jobs_df(
              dataset=dataset,
              job_types=job_types,
          )
          .to_dict(orient="list")
      )
      if pending_jobs.get("revision") and isinstance(
          revision := pending_jobs["revision"][0], str
      ):
          return revision
      return None
  
imports: import logging
  from abc import ABC, abstractmethod
  from dataclasses import dataclass, field
  from http import HTTPStatus
  from typing import Optional, Union
  import pandas
  from libcommon.constants import CONFIG_INFO_KINDS, CONFIG_SPLIT_NAMES_KINDS, DATASET_CONFIG_NAMES_KINDS, DEFAULT_DIFFICULTY_MAX, DIFFICULTY_BONUS_BY_FAILED_RUNS
  from libcommon.processing_graph import ProcessingGraph, ProcessingStep, ProcessingStepDoesNotExist, processing_graph
  from libcommon.prometheus import StepProfiler
  from libcommon.queue import Queue
  from libcommon.simple_cache import CacheEntryDoesNotExistError, delete_dataset_responses, fetch_names, get_best_response, get_cache_entries_df, get_response_metadata, upsert_response_params
  from libcommon.state import ArtifactState, DatasetState, FirstStepsDatasetState
  from libcommon.storage_client import StorageClient
  from libcommon.utils import JobInfo, JobResult, Priority
label_desc: Use image node_id 6 for calling a global function with example usage: get_revision(dataset) and returns: None, revision, revision