docstr: Extract the fully evaluated form of the requested datasets from a Vega specification
  as pandas DataFrames.
  
  :param spec: A Vega specification dict or JSON string
  :param datasets: A list with elements that are either:
    - The name of a top-level dataset as a string
    - A two-element tuple where the first element is the name of a dataset as a string
      and the second element is the nested scope of the dataset as a list of integers
  :param local_tz: Name of timezone to be considered local. E.g. 'America/New_York'.
      Defaults to the value of vf.get_local_tz(), which defaults to the system timezone
      if one can be determined.
  :param default_input_tz: Name of timezone (e.g. 'America/New_York') that naive datetime
      strings should be interpreted in. Defaults to `local_tz`.
  :param row_limit: Maximum number of dataset rows to include in the returned
      datasets. If exceeded, datasets will be truncated to this number of rows
      and a RowLimitExceeded warning will be included in the resulting warnings list
  :param inline_datasets: A dict from dataset names to pandas DataFrames or pyarrow
      Tables. Inline datasets may be referenced by the input specification using
      the following url syntax 'vegafusion+dataset://{dataset_name}' or
      'table://{dataset_name}'.
  :return:
      Two-element tuple:
          0. List of pandas DataFrames corresponding to the input datasets list
          1. A list of warnings as dictionaries. Each warning dict has a 'type'
             key indicating the warning type, and a 'message' key containing
             a description of the warning.
code: def pre_transform_datasets(
      self,
      spec,
      datasets,
      local_tz=None,
      default_input_tz=None,
      row_limit=None,
      inline_datasets=None,
  ):
      """
      Extract the fully evaluated form of the requested datasets from a Vega specification
      as pandas DataFrames.
  
      :param spec: A Vega specification dict or JSON string
      :param datasets: A list with elements that are either:
        - The name of a top-level dataset as a string
        - A two-element tuple where the first element is the name of a dataset as a string
          and the second element is the nested scope of the dataset as a list of integers
      :param local_tz: Name of timezone to be considered local. E.g. 'America/New_York'.
          Defaults to the value of vf.get_local_tz(), which defaults to the system timezone
          if one can be determined.
      :param default_input_tz: Name of timezone (e.g. 'America/New_York') that naive datetime
          strings should be interpreted in. Defaults to `local_tz`.
      :param row_limit: Maximum number of dataset rows to include in the returned
          datasets. If exceeded, datasets will be truncated to this number of rows
          and a RowLimitExceeded warning will be included in the resulting warnings list
      :param inline_datasets: A dict from dataset names to pandas DataFrames or pyarrow
          Tables. Inline datasets may be referenced by the input specification using
          the following url syntax 'vegafusion+dataset://{dataset_name}' or
          'table://{dataset_name}'.
      :return:
          Two-element tuple:
              0. List of pandas DataFrames corresponding to the input datasets list
              1. A list of warnings as dictionaries. Each warning dict has a 'type'
                 key indicating the warning type, and a 'message' key containing
                 a description of the warning.
      """
      if self._grpc_channel:
          raise ValueError(
              "pre_transform_datasets not yet supported over gRPC"
          )
      else:
          local_tz = local_tz or get_local_tz()
  
          # Build input variables
          pre_tx_vars = parse_variables(datasets)
  
          # Serialize inline datasets
          inline_arrow_dataset = (
              self._import_or_register_inline_datasets(inline_datasets)
          )
          try:
              (
                  values,
                  warnings,
              ) = self.embedded_runtime.pre_transform_datasets(
                  spec,
                  pre_tx_vars,
                  local_tz=local_tz,
                  default_input_tz=default_input_tz,
                  row_limit=row_limit,
                  inline_datasets=inline_arrow_dataset,
              )
          finally:
              # Clean up registered tables (both inline and internal temporary tables)
              if self._connection is not None:
                  self._connection.unregister_temporary_tables()
  
          if pl is not None and _all_datasets_have_type(
              inline_datasets, (pl.DataFrame, pl.LazyFrame)
          ):
              # Deserialize values to Polars tables
              datasets = [pl.from_arrow(value) for value in values]
  
              # Localize datetime columns to UTC
              processed_datasets = []
              for df in datasets:
                  for name, dtype in zip(df.columns, df.dtypes):
                      if dtype == pl.Datetime:
                          df = df.with_columns(
                              df[name]
                              .dt.replace_time_zone("UTC")
                              .dt.convert_time_zone(local_tz)
                          )
                  processed_datasets.append(df)
  
              return processed_datasets, warnings
          elif _all_datasets_have_type(inline_datasets, pa.Table):
              return values, warnings
          else:
              # Deserialize values to pandas DataFrames
              datasets = [value.to_pandas() for value in values]
  
              # Localize datetime columns to UTC
              for df in datasets:
                  for name, dtype in df.dtypes.items():
                      if dtype.kind == "M":
                          df[name] = (
                              df[name]
                              .dt.tz_localize("UTC")
                              .dt.tz_convert(local_tz)
                          )
  
              return datasets, warnings
  
imports: import pandas
  import psutil
  import pyarrow
  from typing import Union
  from .connection import SqlConnection
  from .dataset import SqlDataset, DataFrameDataset
  from .datasource import PandasDatasource, DfiDatasource
  from .evaluation import get_mark_group_for_scope
  from .transformer import import_pyarrow_interchange, to_arrow_table
  from .local_tz import get_local_tz
  from typing import TypedDict, List, Literal, Any
label_desc: Use image node_id 12 for calling the VegaFusionRuntime obj's underlying member method code with example usage: obj.pre_transform_datasets(spec, datasets, local_tz, default_input_tz, row_limit, inline_datasets) and returns: processed_datasets,  warnings, values,  warnings, datasets,  warnings