code: def _convert_filled_from_OuterCode(
      filled: cpy.FillReturn_OuterCode,
      fill_type_to: FillType,
  ) -> cpy.FillReturn:
      if fill_type_to == FillType.OuterCode:
          return filled
      elif fill_type_to == FillType.OuterOffset:
          return (
              filled[0],
              [arr.offsets_from_codes(codes) for codes in filled[1]],
          )
  
      if len(filled[0]) > 0:
          points = arr.concat_points(filled[0])
          codes = arr.concat_codes(filled[1])
      else:
          points = None
          codes = None
  
      if fill_type_to == FillType.ChunkCombinedCode:
          return ([points], [codes])
      elif fill_type_to == FillType.ChunkCombinedOffset:
          return (
              [points],
              [
                  None
                  if codes is None
                  else arr.offsets_from_codes(codes)
              ],
          )
      elif fill_type_to == FillType.ChunkCombinedCodeOffset:
          outer_offsets = (
              None
              if points is None
              else arr.offsets_from_lengths(filled[0])
          )
          ret1: cpy.FillReturn_ChunkCombinedCodeOffset = (
              [points],
              [codes],
              [outer_offsets],
          )
          return ret1
      elif fill_type_to == FillType.ChunkCombinedOffsetOffset:
          if codes is None:
              ret2: cpy.FillReturn_ChunkCombinedOffsetOffset = (
                  [None],
                  [None],
                  [None],
              )
          else:
              offsets = arr.offsets_from_codes(codes)
              outer_offsets = arr.outer_offsets_from_list_of_codes(
                  filled[1]
              )
              ret2 = ([points], [offsets], [outer_offsets])
          return ret2
      else:
          raise ValueError(f"Invalid FillType {fill_type_to}")
  
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, cast
  import numpy
  from contourpy._contourpy import FillType, LineType
  import contourpy.array
  from contourpy.enum_util import as_fill_type, as_line_type
  from contourpy.typecheck import check_filled, check_lines
  from contourpy.types import MOVETO, offset_dtype
label_desc: Use image node_id 1 for calling a global function with example usage: _convert_filled_from_OuterCode(filled, fill_type_to) and returns: filled, list,  list, filled,  unknown, list,  list, ret1, ret2