code: def generate(self, data, width, height, padding=(0, 0, 0, 0), output_format="png", inverted=False):
          
  
          # Calculate the digest, and get byte list.
          digest_byte_list = self._data_to_digest_byte_list(data)
  
          # Create the matrix describing which block should be filled-in.
          matrix = self._generate_matrix(digest_byte_list)
  
          # Determine the background and foreground colours.
          if output_format == "ascii":
              foreground = "+"
              background = "-"
          else:
              background = self.background
              foreground = self.foreground[digest_byte_list[0] % len(self.foreground)]
  
          # Swtich the colours if inverted image was requested.
          if inverted:
              foreground, background = background, foreground
  
          # Generate the identicon in requested format.
          if output_format == "ascii":
              return self._generate_ascii(matrix, foreground, background)
          else:
              return self._generate_image(matrix, width, height, padding, foreground, background, output_format)
docs: Generates an identicon image with requested width, height, padding, and
          output format, optionally inverting the colours in the indeticon
          (swapping background and foreground colours) if requested.
  
          Arguments:
  
            data - Hashed or raw data that will be used for generating the
            identicon.
  
            width - Width of resulting identicon image in pixels.
  
            height - Height of resulting identicon image in pixels.
  
            padding - Tuple describing padding around the generated identicon. The
            tuple should consist out of four values, where each value is the
            number of pixels to use for padding. The order in tuple is: top,
            bottom, left, right.
  
            output_format - Output format of resulting identicon image. Supported
            formats are anything that is supported by Pillow, plus a special
            "ascii" mode.
  
            inverted - Specifies whether the block colours should be inverted or
            not. Default is False.
  
          Returns:
  
            Byte representation of an identicon image.