STRATFORD, Great Britain — Ernest Hemingway famously coined the phrase, “Write drunk; edit sober,” but centuries earlier William Shakespeare may have preferred a different substance to get the creative juices flowing.

Scientists from South Africa have excavated 400-year-old tobacco pipes from Shakespeare’s garden and found them to contain cannabis residue, The Independent reported.

The pipes were analyzed in Pretoria, South Africa using a technique called gas chromatography mass spectrometry, which is sensitive to residues preserved in pipes. The items were on loan from the Shakespeare Birthplace Trust.

Shakespeare may have alluded to his affinity for cannabis in “Sonnet 76,” where he wrote “invention in a noted weed.” Analysts have interpreted this phrase to mean that the famed poet and playwright was willing to use “weed” for creative writing (“invention”).

The 17th century had several types of tobacco, including the North American Nicotiana, from which nicotine is derived, and cocaine obtained from Peruvian coca leaves.

Chemists who analyzed residues in 17th-century tobacco pipes have confirmed that a diversity of plants was smoked in Europe during that time. No residues containing cocaine were found in the pipes found in Shakespeare’s garden.