code: def split_records(
      items: Iterable,
      content_field: str | int,
      itemwise: bool = False,
  ) -> Iterable:
      """
      Split records' content (text) from associated metadata, but keep them paired
      together.
  
      Args:
          items: An iterable of dicts, e.g. as read from disk by
              :func:`read_json(lines=True) <textacy.io.json.read_json>`,
              or an iterable of lists, e.g. as read from disk by
              :func:`read_csv() <textacy.io.csv.read_csv>`.
          content_field: If str, key in each dict item whose value is the item's content (text);
              if int, index of the value in each list item corresponding to the item's content (text).
          itemwise: If True, content + metadata are paired item-wise
              as an iterable of (content, metadata) 2-tuples; if False, content +
              metadata are paired by position in two parallel iterables in the form of
              a (iterable(content), iterable(metadata)) 2-tuple.
  
      Returns:
          Generator(tuple[str, dict]): If ``itemwise`` is True and ``items`` is Iterable[dict];
          the first element in each tuple is the item's content,
          the second element is its metadata as a dictionary.
  
          Generator(tuple[str, list]): If ``itemwise`` is True and ``items`` is Iterable[list];
          the first element in each tuple is the item's content,
          the second element is its metadata as a list.
  
          tuple[Iterable[str], Iterable[dict]]: If ``itemwise`` is False and
          ``items`` is Iterable[dict];
          the first element of the tuple is an iterable of items' contents,
          the second is an iterable of their metadata dicts.
  
          tuple[Iterable[str], Iterable[list]]: If ``itemwise`` is False and
          ``items`` is Iterable[list];
          the first element of the tuple is an iterable of items' contents,
          the second is an iterable of their metadata lists.
      """
      if itemwise is True:
          return ((item.pop(content_field), item) for item in items)
      else:
          return unzip(
              ((item.pop(content_field), item) for item in items)
          )
  
imports: from __future__ import annotations
  import bz2
  import gzip
  import io
  import itertools
  import logging
  import lzma
  import os
  import re
  import shutil
  import tarfile
  import urllib
  import zipfile
  from typing import IO, Iterable, Literal, Optional
  from cytoolz import itertoolz
  from ..None import constants
  from ..None import errors
  from ..None import types, utils
  from .http import write_http_stream
label_desc: Use image node_id 8 for calling a global function with example usage: split_records(items, content_field, itemwise) and returns: unknown, unzip