docs: def dump(self, stream, index=0, count=0, output=str()):
          """ Dumps the content of the byte *stream* to the console or to the
          optional given *output* file.
  
          :param bytes stream: byte stream to view.
          :param int index: optional start index of the viewing area in bytes.
              Default is the begin of the stream.
          :param int count: optional number of bytes to view.
              Default is to the end of the stream.
          :param str output: location and name for the optional output file.
          """
  
          def numerate(pattern, _count):
              return ''.join(pattern.format(x) for x in range(_count))
  
          def write_to(file_handle, content):
              if file_handle:
                  file_handle.write(content + "\n")
              else:
                  print(content)
  
          dst = None
          if output:
              dst = open(output, 'w')
  
          start, stop = self._view_area(stream, index, count)
          digits = max(len(hex(start + stop)) - 2, 8)
  
          # Write header
          write_to(dst,
                   " " * digits +
                   " |" +
                   numerate(" {0:02d}", self.columns) +
                   " |")
          write_to(dst,
                   "-" * digits +
                   "-+" +
                   "-" * (self.columns * 3) +
                   "-+-" +
                   "-" * self.columns)
  
          # Set start row and column
          row = int(start / self.columns)
          column = int(start % self.columns)
  
          # Initialize output for start index row
          output_line = "{0:0{1:d}X} |".format(row * self.columns,
                                               digits)
          output_line += " .." * column
          output_ascii = "." * column
  
          # Iterate over viewing area
          for value in stream[start:stop]:
              column += 1
              output_line += " {0:02X}".format(int(value))
              if value in range(32, 126):
                  output_ascii += "{0:c}".format(value)
              else:
                  output_ascii += "."
              column %= self.columns
              if not column:
                  # Write output line
                  output_line += ' | ' + output_ascii
                  write_to(dst, output_line)
                  # Next row
                  row += 1
                  output_line = "{0:0{1:d}X} |".format(row * self.columns,
                                                       digits)
                  output_ascii = ""
  
          # Write output of stop index row
          if column:
              # Fill missing columns with white spaces
              output_line += " " * (self.columns - column) * 3
              output_line += " | " + output_ascii
              write_to(dst, output_line)