James Leeson (1756–1794) is buried in New York's Trinity Church Cemetery. His tombstone bears a curious inscription. It remained a local puzzle until 1889, when the Trinity Record discovered that it is reads as REMEMBER DEATH encoded in pigpen cipher.

James Leeson
Tombstone of James Leeson (1756-1794) in New York's Trinity Church Cemetery. Note that the cipher on top of the stone makes use of a slightly different key compared to the one used in this exercise: the wrinkle is that J is omitted, because in colonial orthography it was identical with I. All letters following J in the alphabet therefore shift one position forward in the grids of the key used for encoding and decoding.

The pigpen cipher (sometimes referred to as the masonic cipher or Freemason's cipher) is a geometric simple substitution cipher that exchanges letters for symbols which are fragments of a grid. The exact origin of the cipher is uncertain, but records of this system have been found which go back to at least the 18th century. Variations of this cipher were used by both the Rosicrucian brotherhood and the Freemasons, though the latter used it so often that the system is frequently called the Freemason's cipher. They began using it in the early 18th century to keep their records of history and rites private, and for correspondence between lodge leaders.

The oldest known version is from Heinrich Cornelius Agrippa von Nettesheim who explains the method in his De occulta philosophia published in 1533. This work was reused in 1586 by Blaise de Vigenère in his treatise about cryptography. There are many possible variations, but any trained crypto-analyst will usually have no trouble deciphering the encoded messages.

Assignment

Your task is to decode a given word according to the pigpen cipher that makes use of the following key.

rozenkruisersgeheimschrift

This is done by substituting each letter of the word by its symbolic representation in the pigpen cipher. This representation forms a $$3 \times 3$$ grid of characters. The middle character of the symbolic representation indicates what grid of the key contains the letter: a space represents the left grid, a dot (.) the middle grid, and a colon (:) the grid to the right. In addition, lines must be drawn to the left, right, top and bottom according to the position of the letter in the grid. As an example, the symbolic representation of all letters in the middle grid are depicted below.

       |     | |     |       --+     +-+     +--     --+     +-+     +--
      .|     |.|     |.       .|     |.|     |.       .|     |.|     |. 
     --+     +-+     +--     --+     +-+     +--       |     | |     |  

      J       K       L       M       N       O       P       Q       R

Note that fragments of a horizontal line are thus represented by a dash (-) and fragments of a vertical line by a pipe symbol (|). Corner points of the symbolic representation where two lines meet are represented by a plus sign (+). Your task:

Both functions must handle the given string in a case insensitive way.

Example

>>> print(pigpenletter('A'))
  |
  |
--+
>>> print(pigpenletter('m'))
--+
 .|
--+
>>> print(pigpenletter('U'))
|  
|: 
+--

>>> print(pigpen('python'))
--+ --+ | | +-+ +-- +-+
 .|  :| |:| | | |.  |.|
  |   | +-+ | | +-- +-+
>>> print(pigpen('Rosenkreutz'))
+-- +--   | +-+ +-+ | | +-- +-+ |   | | +-+
|.  |.   :| | | |.| |.| |.  | | |:  |:| |:|
|   +-- --+ +-+ +-+ +-+ |   +-+ +-- +-+ | |