code: def _convert_listlike_datetimes(
      arg,
      format: str | None,
      name: Hashable = None,
      utc: bool = False,
      unit: str | None = None,
      errors: DateTimeErrorChoices = "raise",
      dayfirst: bool | None = None,
      yearfirst: bool | None = None,
      exact: bool = True,
  ):
      """
      Helper function for to_datetime. Performs the conversions of 1D listlike
      of dates
  
      Parameters
      ----------
      arg : list, tuple, ndarray, Series, Index
          date to be parsed
      name : object
          None or string for the Index name
      utc : bool
          Whether to convert/localize timestamps to UTC.
      unit : str
          None or string of the frequency of the passed data
      errors : str
          error handing behaviors from to_datetime, 'raise', 'coerce', 'ignore'
      dayfirst : bool
          dayfirst parsing behavior from to_datetime
      yearfirst : bool
          yearfirst parsing behavior from to_datetime
      exact : bool, default True
          exact format matching behavior from to_datetime
  
      Returns
      -------
      Index-like of parsed dates
      """
      if isinstance(arg, (list, tuple)):
          arg = np.array(arg, dtype="O")
      elif isinstance(arg, PandasArray):
          arg = np.array(arg)
  
      arg_dtype = getattr(arg, "dtype", None)
      # these are shortcutable
      tz = "utc" if utc else None
      if is_datetime64tz_dtype(arg_dtype):
          if not isinstance(arg, (DatetimeArray, DatetimeIndex)):
              return DatetimeIndex(arg, tz=tz, name=name)
          if utc:
              arg = arg.tz_convert(None).tz_localize("utc")
          return arg
  
      elif is_datetime64_dtype(arg_dtype):
          arg_dtype = cast(np.dtype, arg_dtype)
          if not is_supported_unit(get_unit_from_dtype(arg_dtype)):
              # We go to closest supported reso, i.e. "s"
              arg = astype_overflowsafe(
                  # TODO: looks like we incorrectly raise with errors=="ignore"
                  np.asarray(arg),
                  np.dtype("M8[s]"),
                  is_coerce=errors == "coerce",
              )
  
          if not isinstance(arg, (DatetimeArray, DatetimeIndex)):
              return DatetimeIndex(arg, tz=tz, name=name)
          elif utc:
              # DatetimeArray, DatetimeIndex
              return arg.tz_localize("utc")
  
          return arg
  
      elif unit is not None:
          if format is not None:
              raise ValueError("cannot specify both format and unit")
          return _to_datetime_with_unit(arg, unit, name, utc, errors)
      elif getattr(arg, "ndim", 1) > 1:
          raise TypeError(
              "arg must be a string, datetime, list, tuple, 1-d array, or Series"
          )
  
      # warn if passing timedelta64, raise for PeriodDtype
      # NB: this must come after unit transformation
      try:
          arg, _ = maybe_convert_dtype(
              arg, copy=False, tz=libtimezones.maybe_get_tz(tz)
          )
      except TypeError:
          if errors == "coerce":
              npvalues = np.array(
                  ["NaT"], dtype="datetime64[ns]"
              ).repeat(len(arg))
              return DatetimeIndex(npvalues, name=name)
          elif errors == "ignore":
              idx = Index(arg, name=name)
              return idx
          raise
  
      arg = ensure_object(arg)
  
      if format is None:
          format = _guess_datetime_format_for_array(
              arg, dayfirst=dayfirst
          )
  
      # `format` could be inferred, or user didn't ask for mixed-format parsing.
      if format is not None and format != "mixed":
          return _array_strptime_with_fallback(
              arg, name, utc, format, exact, errors
          )
  
      result, tz_parsed = objects_to_datetime64ns(
          arg,
          dayfirst=dayfirst,
          yearfirst=yearfirst,
          utc=utc,
          errors=errors,
          allow_object=True,
      )
  
      if tz_parsed is not None:
          # We can take a shortcut since the datetime64 numpy array
          # is in UTC
          dta = DatetimeArray(result, dtype=tz_to_dtype(tz_parsed))
          return DatetimeIndex._simple_new(dta, name=name)
  
      return _box_as_indexlike(result, utc=utc, name=name)
  
imports: from __future__ import annotations
  from collections import abc
  from datetime import datetime
  from functools import partial
  from itertools import islice
  from typing import TYPE_CHECKING, Callable, Hashable, List, Tuple, TypedDict, Union, cast, overload
  import warnings
  import numpy
  from pandas._libs import lib, tslib
  from pandas._libs.tslibs import OutOfBoundsDatetime, Timedelta, Timestamp, astype_overflowsafe, get_unit_from_dtype, iNaT, is_supported_unit, nat_strings, parsing, timezones
  from pandas._libs.tslibs.conversion import precision_from_unit
  from pandas._libs.tslibs.parsing import DateParseError, guess_datetime_format
  from pandas._libs.tslibs.strptime import array_strptime
  from pandas._typing import AnyArrayLike, ArrayLike, DateTimeErrorChoices, npt
  from pandas.util._exceptions import find_stack_level
  from pandas.core.dtypes.common import ensure_object, is_datetime64_dtype, is_datetime64tz_dtype, is_float, is_integer, is_integer_dtype, is_list_like, is_numeric_dtype, is_scalar
  from pandas.core.dtypes.generic import ABCDataFrame, ABCSeries
  from pandas.core.dtypes.missing import notna
  from pandas.arrays import DatetimeArray, IntegerArray, PandasArray
  from pandas.core import algorithms
  from pandas.core.algorithms import unique
  from pandas.core.arrays.base import ExtensionArray
  from pandas.core.arrays.datetimes import maybe_convert_dtype, objects_to_datetime64ns, tz_to_dtype
  from pandas.core.construction import extract_array
  from pandas.core.indexes.base import Index
  from pandas.core.indexes.datetimes import DatetimeIndex
label_desc: Use image node_id 7 for calling a global function with example usage: _convert_listlike_datetimes(arg, format, name, utc, unit, errors, dayfirst, yearfirst, exact) and returns: _box_as_indexlike, arg, _array_strptime_with_fallback, DatetimeIndex, DatetimeIndex, arg, DatetimeIndex, _to_datetime_with_unit, DatetimeIndex, arg, idx