code: def list_runs(
      experiment_name: str,
      created_before: Optional[datetime.datetime] = None,
      created_after: Optional[datetime.datetime] = None,
      sagemaker_session: Optional["Session"] = None,
      max_results: Optional[int] = None,
      next_token: Optional[str] = None,
      sort_by: SortByType = SortByType.CREATION_TIME,
      sort_order: SortOrderType = SortOrderType.DESCENDING,
  ) -> list:
      """Return a list of ``Run`` objects matching the given criteria.
  
      Args:
          experiment_name (str): Only Run objects related to the specified experiment
              are returned.
          created_before (datetime.datetime): Return Run objects created before this instant
              (default: None).
          created_after (datetime.datetime): Return Run objects created after this instant
              (default: None).
          sagemaker_session (sagemaker.session.Session): Session object which
              manages interactions with Amazon SageMaker APIs and any other
              AWS services needed. If not specified, one is created using the
              default AWS configuration chain.
          max_results (int): Maximum number of Run objects to retrieve (default: None).
          next_token (str): Token for next page of results (default: None).
          sort_by (SortByType): The property to sort results by. One of NAME, CREATION_TIME
              (default: CREATION_TIME).
          sort_order (SortOrderType): One of ASCENDING, or DESCENDING (default: DESCENDING).
  
      Returns:
          list: A list of ``Run`` objects.
      """
  
      # all trial components retrieved by default
      tc_summaries = _TrialComponent.list(
          experiment_name=experiment_name,
          created_before=created_before,
          created_after=created_after,
          sort_by=sort_by.value,
          sort_order=sort_order.value,
          sagemaker_session=sagemaker_session,
          max_results=max_results,
          next_token=next_token,
      )
      run_list = []
      for tc_summary in tc_summaries:
          if not is_run_trial_component(
              trial_component_name=tc_summary.trial_component_name,
              sagemaker_session=sagemaker_session,
          ):
              continue
          run_instance = Run(
              experiment_name=experiment_name,
              run_name=Run._extract_run_name_from_tc_name(
                  trial_component_name=tc_summary.trial_component_name,
                  experiment_name=experiment_name,
              ),
              sagemaker_session=sagemaker_session,
          )
          run_list.append(run_instance)
      return run_list
  
imports: from __future__ import absolute_import
  import datetime
  import logging
  from enum import Enum
  from math import isnan, isinf
  from numbers import Number
  from typing import Optional, List, Dict, TYPE_CHECKING, Union
  import dateutil
  from numpy import array
  from sagemaker.apiutils import _utils
  from sagemaker.experiments import _api_types
  from sagemaker.experiments._api_types import TrialComponentArtifact, _TrialComponentStatusType
  from sagemaker.experiments._helper import _ArtifactUploader, _LineageArtifactTracker, _DEFAULT_ARTIFACT_PREFIX
  from sagemaker.experiments._environment import _RunEnvironment
  from sagemaker.experiments._run_context import _RunContext
  from sagemaker.experiments.experiment import Experiment
  from sagemaker.experiments._metrics import _MetricsManager
  from sagemaker.experiments.trial import _Trial
  from sagemaker.experiments.trial_component import _TrialComponent
  from sagemaker.utils import get_module, unique_name_from_base, format_tags, Tags, TagsDict
  from sagemaker.experiments._utils import guess_media_type, resolve_artifact_name, verify_length_of_true_and_predicted, validate_invoked_inside_run_context, get_tc_and_exp_config_from_job_env, verify_load_input_names, is_run_trial_component
label_desc: Use image node_id 2 for calling a global function with example usage: list_runs(experiment_name, created_before, created_after, sagemaker_session, max_results, next_token, sort_by, sort_order) and returns: run_list