def _generate_ascii(self, matrix, foreground, background):
        """
        Generates an identicon "image" in the ASCII format. The image will just
        output the matrix used to generate the identicon.

        Arguments:

          matrix - Matrix describing which blocks in the identicon should be
          painted with foreground (background if inverted) colour.

          foreground - Character which should be used for representing
          foreground.

          background - Character which should be used for representing
          background.

        Returns:

          ASCII representation of an identicon image, where one block is one
          character.
        """

        return "\n".join(["".join([foreground if cell else background for cell in row]) for row in matrix])