def _Scroll(self, lines=None):
    """Set attributes to scroll the buffer correctly.

    Args:
      lines: An int, number of lines to scroll. If None, scrolls
        by the terminal length.
    """
    if lines is None:
      lines = self._cli_lines

    if lines < 0:
      self._displayed -= self._cli_lines
      self._displayed += lines
      if self._displayed < 0:
        self._displayed = 0
      self._lines_to_show = self._cli_lines
    else:
      self._lines_to_show = lines

    self._lastscroll = lines
Set attributes to scroll the buffer correctly.

    Args:
      lines: An int, number of lines to scroll. If None, scrolls
        by the terminal length.