code: def cast_value_for_extend(
      values: Union[StringifyValue, Namespace, Series, Collection[Any]]
  ) -> Optional[Union[Series, Namespace]]:
      from_stringify_value, original_values = False, None
      if is_stringify_value(values):
          from_stringify_value, original_values, values = (
              True,
              values,
              values.value,
          )
  
      if isinstance(values, Namespace):
          return values
      elif is_dict_like(values):
          return Namespace(values)
      elif isinstance(values, Series):
          return values
  
      sample_val = next(iter(values))
  
      if isinstance(sample_val, File):
          return FileSeries(values=values)
      elif File.is_convertable_to_image(sample_val):
          return FileSeries(values=values)
      elif File.is_convertable_to_html(sample_val):
          return FileSeries(values=values)
      elif is_string(sample_val):
          return StringSeries(values=values)
      elif is_float_like(sample_val):
          return FloatSeries(values=values)
      elif from_stringify_value:
          return StringSeries(values=original_values)
  
file_path: neptune-client/src/neptune/types/type_casting.py
imports: import argparse
  from datetime import datetime
  from typing import Any, Collection, Optional, Union
  from neptune.internal.types.stringify_value import StringifyValue
  from neptune.internal.utils import is_bool, is_dict_like, is_float, is_float_like, is_int, is_string, is_stringify_value
  from neptune.types import Boolean, File, Integer
  from neptune.types.atoms.datetime import Datetime
  from neptune.types.atoms.float import Float
  from neptune.types.atoms.string import String
  from neptune.types.namespace import Namespace
  from neptune.types.series import FileSeries, FloatSeries, StringSeries
  from neptune.types.series.series import Series
  from neptune.types.value import Value
  from neptune.types.value_copy import ValueCopy
label_desc: Use image node_id 2 for calling a global function with example usage: cast_value_for_extend(values) and returns: values, FileSeries, Namespace, FileSeries, values, FileSeries, StringSeries, FloatSeries, StringSeries