code: def translate_logical_line(start, end, contents, indent_stack, endmarker=False):
      
      # Remove leading blank lines.
      while contents[0] == '\n':
        start += 1
        contents.pop(0)
      # Remove trailing blank lines.
      while contents[-1] == '\n':
        end -= 1
        contents.pop()
  
      indent = len(indent_stack[-1]) if indent_stack else 0
      if endmarker:
        indent = len(contents[0])
      return start, end + 1, indent
docs: Translate raw contents to logical lines