code: def code_to_line(code, cursor_pos):
      """Turn a multiline code block and cursor position into a single line
      and new cursor position.
  
      For adapting ``complete_`` and ``object_info_request``.
      """
      if not code:
          return "", 0
      for line in code.splitlines(True):
          n = len(line)
          if cursor_pos > n:
              cursor_pos -= n
          else:
              break
      return line, cursor_pos
  
imports: import re
  import json
  from jupyter_client import protocol_version_info
label_desc: Use image node_id 1 for calling a global function with example usage: code_to_line(code, cursor_pos) and returns: line,  cursor_pos, str,  int