code: def decode(block, encoding, errors, line_delimiter):
      # blocksize is not None branch
      text = block.decode(encoding, errors)
      if line_delimiter in [None, "", "\n", "\r", "\r\n"]:
          lines = io.StringIO(text, newline=line_delimiter)
          return list(lines)
      else:
          if not text:
              return []
          parts = text.split(line_delimiter)
          out = [t + line_delimiter for t in parts[:-1]] + (
              parts[-1:] if not text.endswith(line_delimiter) else []
          )
          return out
  
file_path: dask/dask/bag/text.py
imports: from __future__ import annotations
  import io
  from functools import partial
  from fsspec.core import open_files
  from tlz import concat
  from dask.bag.core import from_delayed
  from dask.bytes import read_bytes
  from dask.delayed import delayed
  from dask.utils import parse_bytes, system_encoding
label_desc: Use image node_id 4 for calling a global function with example usage: decode(block, encoding, errors, line_delimiter) and returns: list, out, list