code: def split_lines(string: str, keepends: bool = False) -> Sequence[str]:
      r"""
      Intended for Python code. In contrast to Python's :py:meth:`str.splitlines`,
      looks at form feeds and other special characters as normal text. Just
      splits ``\n`` and ``\r\n``.
      Also different: Returns ``[""]`` for an empty string input.
  
      In Python 2.7 form feeds are used as normal characters when using
      str.splitlines. However in Python 3 somewhere there was a decision to split
      also on form feeds.
      """
      if keepends:
          lst = string.splitlines(True)
  
          # We have to merge lines that were broken by form feed characters.
          merge = []
          for i, line in enumerate(lst):
              try:
                  last_chr = line[-1]
              except IndexError:
                  pass
              else:
                  if last_chr in _NON_LINE_BREAKS:
                      merge.append(i)
  
          for index in reversed(merge):
              try:
                  lst[index] = lst[index] + lst[index + 1]
                  del lst[index + 1]
              except IndexError:
                  # index + 1 can be empty and therefore there's no need to
                  # merge.
                  pass
  
          # The stdlib's implementation of the end is inconsistent when calling
          # it with/without keepends. One time there's an empty string in the
          # end, one time there's none.
          if (
              string.endswith("\n")
              or string.endswith("\r")
              or string == ""
          ):
              lst.append("")
          return lst
      else:
          return re.split(r"\n|\r\n|\r", string)
  
file_path: catboost/contrib/python/parso/py3/parso/utils.py
imports: import re
  import sys
  from ast import literal_eval
  from functools import total_ordering
  from typing import NamedTuple, Sequence, Union
label_desc: Use image node_id 1 for calling a global function with example usage: split_lines(string, keepends) and returns: lst, re