code: def create_char(self, location, bitmap):
          
          assert 0 <= location <= 7, 'Only locations 0-7 are valid.'
          assert len(bitmap) == 8, 'Bitmap should have exactly 8 rows.'
  
          # Store previous position
          pos = self.cursor_pos
  
          # Write character to CGRAM
          self.command(c.LCD_SETCGRAMADDR | location << 3)
          for row in bitmap:
              self._send_data(row)
  
          # Restore cursor pos
          self.cursor_pos = pos
docs: Create a new character.
  
          The HD44780 supports up to 8 custom characters (location 0-7).
  
          :param location: The place in memory where the character is stored.
              Values need to be integers between 0 and 7.
          :type location: int
          :param bitmap: The bitmap containing the character. This should be a
              tuple of 8 numbers, each representing a 5 pixel row.
          :type bitmap: tuple of int
          :raises AssertionError: Raised when an invalid location is passed in or
              when bitmap has an incorrect size.
  
          Example:
  
          .. sourcecode:: python
  
              >>> smiley = (
              ...     0b00000,
              ...     0b01010,
              ...     0b01010,
              ...     0b00000,
              ...     0b10001,
              ...     0b10001,
              ...     0b01110,
              ...     0b00000,
              ... )
              >>> lcd.create_char(0, smiley)