code: def get_real_end_line(token):
      
      end_line = token.end_mark.line + 1
  
      if not isinstance(token, yaml.ScalarToken):
          return end_line
  
      pos = token.end_mark.pointer - 1
      while (pos >= token.start_mark.pointer - 1 and
             token.end_mark.buffer[pos] in string.whitespace):
          if token.end_mark.buffer[pos] == '\n':
              end_line -= 1
          pos -= 1
      return end_line
docs: Finds the line on which the token really ends.
  
      With pyyaml, scalar tokens often end on a next line.