code: def _expand_dict_scalars(
      data: Mapping[
          str,
          Sequence[object] | Mapping[str, Sequence[object]] | Series,
      ],
      *,
      schema_overrides: SchemaDict | None = None,
      order: Sequence[str] | None = None,
      nan_to_null: bool = False,
  ) -> dict[str, Series]:
      """Expand any scalar values in dict data (propagate literal as array)."""
      updated_data = {}
      if data:
          if any(isinstance(val, pl.Expr) for val in data.values()):
              raise TypeError(
                  "passing Expr objects to the DataFrame constructor is not supported"
                  "\n\nHint: Try evaluating the expression first using `select`,"
                  " or if you meant to create an Object column containing expressions,"
                  " pass a list of Expr objects instead."
              )
  
          dtypes = schema_overrides or {}
          data = _expand_dict_data(data, dtypes)
          array_len = max((arrlen(val) or 0) for val in data.values())
          if array_len > 0:
              for name, val in data.items():
                  dtype = dtypes.get(name)
                  if isinstance(val, dict) and dtype != Struct:
                      updated_data[name] = pl.DataFrame(val).to_struct(
                          name
                      )
  
                  elif isinstance(val, pl.Series):
                      s = val.rename(name) if name != val.name else val
                      if dtype and dtype != s.dtype:
                          s = s.cast(dtype)
                      updated_data[name] = s
  
                  elif arrlen(val) is not None or _is_generator(val):
                      updated_data[name] = pl.Series(
                          name=name,
                          values=val,
                          dtype=dtype,
                          nan_to_null=nan_to_null,
                      )
                  elif (
                      val is None
                      or isinstance(  # type: ignore[redundant-expr]
                          val,
                          (
                              int,
                              float,
                              str,
                              bool,
                              date,
                              datetime,
                              time,
                              timedelta,
                          ),
                      )
                  ):
                      updated_data[name] = pl.Series(
                          name=name, values=[val], dtype=dtype
                      ).extend_constant(val, array_len - 1)
                  else:
                      updated_data[name] = pl.Series(
                          name=name,
                          values=[val] * array_len,
                          dtype=dtype,
                      )
  
          elif all((arrlen(val) == 0) for val in data.values()):
              for name, val in data.items():
                  updated_data[name] = pl.Series(
                      name, values=val, dtype=dtypes.get(name)
                  )
  
          elif all((arrlen(val) is None) for val in data.values()):
              for name, val in data.items():
                  updated_data[name] = pl.Series(
                      name,
                      values=(val if _is_generator(val) else [val]),
                      dtype=dtypes.get(name),
                  )
      if order and list(updated_data) != order:
          return {col: updated_data.pop(col) for col in order}
      return updated_data
  
imports: from __future__ import annotations
  import contextlib
  import warnings
  from datetime import date, datetime, time, timedelta
  from decimal import Decimal
  from functools import lru_cache, singledispatch
  from itertools import islice, zip_longest
  from operator import itemgetter
  from sys import version_info
  from typing import TYPE_CHECKING, Any, Callable, Generator, Iterable, Iterator, Mapping, MutableMapping, Sequence, get_type_hints
  import polars._reexport
  from polars import functions
  from polars.datatypes import INTEGER_DTYPES, N_INFER_DEFAULT, TEMPORAL_DTYPES, Boolean, Categorical, Date, Datetime, Duration, Enum, List, Null, Object, String, Struct, Time, UInt32, Unknown, dtype_to_py_type, is_polars_dtype, numpy_char_code_to_dtype, py_type_to_dtype
  from polars.datatypes.constructor import numpy_type_to_constructor, numpy_values_and_dtype, polars_type_to_constructor, py_type_to_constructor
  from polars.dependencies import _NUMPY_AVAILABLE, _check_for_numpy, _check_for_pandas, _check_for_pydantic, dataclasses, pydantic
  from polars.dependencies import numpy
  from polars.dependencies import pandas
  from polars.dependencies import pyarrow
  from polars.exceptions import ComputeError, ShapeError, TimeZoneAwareConstructorWarning
  from polars.utils._wrap import wrap_df, wrap_s
  from polars.utils.meta import get_index_type, threadpool_size
  from polars.utils.various import _is_generator, arrlen, find_stacklevel, parse_version, range_to_series
label_desc: Use image node_id 22 for calling a global function with example usage: _expand_dict_scalars(data) and returns: updated_data, unknown