The bacteria used to create tequila just got a new job: making the molecules naturally produced by the cannabis plant.

Farmako , a biotech firm based in Frankfurt, Germany, filed an international patent for the genetically-modified microorganisms in February. The bacteria, Zymomonas mobilis, is one of the key ingredients for manufacturing tequila. In the tequila-making process, the bacteria convert glucose — or sugar — into booze.

Farmako’s weedy version of the bug, which it dubbed Zymomonas cannabinoidis, turns sugar into THC. Or CBD. Or any of the 100+ cannabinoids found in cannabis .

"With one production run, we can produce cannabinoids for 900 hours without interruption,” said Farmako’s co-founder and Chief Science Officer, Patrick Schmitt, in a press release. “For example, 4.5 kilograms of THC are produced per gram of bacterial mass during this time.”

To create Z. cannabinoidis, Farmako’s scientists used molecular scissors to snip out the genes responsible for making alcohol. The missing DNA segments were replaced with genes for individual cannabinoids.

The on-demand system means the company can produce any cannabinoid, at any time, for a fraction of the cost to cultivate, extract, and process cannabinoids directly from the plant.

“The production of cannabinoids and finished medicines based on cannabinoids will be synthetic in the future,” said Farmako’s founder and CEO, Niklas Kouparanis, according to the same press release. “With the patent application, we have now managed to remove a big question mark from the world as to exactly what this production looks like.”

Pharmaceutical companies have taken a keen interest in cannabinoids like THC and CBD due to the compounds’ medicinal properties. However, some cannabinoids, like THCV , which suppresses appetite and could help people with eating disorders, or CBN , which reduces inflammation, are produced by the cannabis plant at incredibly low levels.

For these less prominent cannabinoids, research and development can be cost prohibitive. Hundreds, if not thousands, of weed plants are needed to extract enough of these rarer cannabinoids to work with.

If Farmako’s claims hold up, then Z. cannabinoidis not only makes production of these cannabinoids much cheaper, it speeds up the entire extraction process, too. And time, after all, is money.

The bacterial bud-factories aren’t the first microorganisms designed to produce cannabinoids. Earlier this month, researchers at the University of California-Berkeley created yeast that make cannabinoids in a similar fashion as Z. cannabinoidis.

But yeast cells must be destroyed to release their cannabinoids. Farmako’s bacteria excrete cannabinoids directly into solution, skipping the costly and time-consuming cell-smashing step required with yeast.

In addition to yeast, last year, Canada’s InMed Pharmaceuticals announced it created E. coli bacteria — the bacteria found in poop — to produce cannabinoids from sugar.

Since these cannabinoids come from pharmaceutical companies, they will likely never be offered in a smokable form. Which is fine. While scientists draw cannabinoids from vats, the rest of us can draw ours from bongs.