code: def get_line_number (s, index):
      r
      i = 0
      if index < 0:
          return 0
      line = 1
      while i < index:
          if s[i] == '\n':
              line += 1
          i += 1
      return line
docs: r"""Return the line number of s[index] or zero on errors.
      Lines are assumed to be separated by the ASCII character '\n'.