code: def line_at_cursor(cell, cursor_pos=0):
      """Return the line in a cell at a given cursor position
  
      Used for calling line-based APIs that don't support multi-line input, yet.
  
      Parameters
      ----------
  
      cell: str
          multiline block of text
      cursor_pos: integer
          the cursor position
  
      Returns
      -------
  
      (line, offset): (text, integer)
          The line with the current cursor, and the character offset of the start of the line.
      """
      offset = 0
      lines = cell.splitlines(True)
      for line in lines:
          next_offset = offset + len(line)
          if next_offset >= cursor_pos:
              break
          offset = next_offset
      else:
          line = ""
      return (line, offset)
  
file_path: catboost/contrib/python/ipython/py2/IPython/utils/tokenutil.py
imports: from __future__ import absolute_import, print_function
  from collections import namedtuple
  from io import StringIO
  from keyword import iskeyword
  from .None import tokenize2
  from .py3compat import cast_unicode_py2
label_desc: Use image node_id 2 for calling a global function with example usage: line_at_cursor(cell, cursor_pos) and returns: line,  offset