code: def list_rllib_tests(
      n: int = -1, test: str = None
  ) -> Tuple[str, List[str]]:
      """List RLlib tests.
  
      Args:
          n: return at most n tests. all tests if n = -1.
          test: only return information about a specific test.
      """
      tests_res = _run_shell(
          [
              "bazel",
              "query",
              "tests(//python/ray/rllib:*)",
              "--output",
              "label",
          ]
      )
  
      all_tests = []
  
      # Strip, also skip any empty lines
      tests = [t.strip() for t in tests_res.splitlines() if t.strip()]
      for t in tests:
          if test and t != test:
              continue
  
          src_out = _run_shell(
              [
                  "bazel",
                  "query",
                  'kind("source file", deps({}))'.format(t),
                  "--output",
                  "label",
              ]
          )
  
          srcs = [f.strip() for f in src_out.splitlines()]
          srcs = [
              f
              for f in srcs
              if f.startswith("//python") and f.endswith(".py")
          ]
          if srcs:
              all_tests.append((t, srcs))
  
          # Break early if smoke test.
          if n > 0 and len(all_tests) >= n:
              break
  
      return all_tests
  
imports: import argparse
  import ast
  import os
  import re
  import subprocess
  import sys
  from typing import Dict, List, Tuple
label_desc: Use image node_id 2 for calling a global function with example usage: list_rllib_tests(n, test) and returns: all_tests