Setting up stems

How do I set up and read stems in G3?

I want to make something to add a stem from selected points in a layer (adding the proper value to each master as long as the outlines are compatible), but all I can find is that stems are set as a single list, without options to select the orientation or filters.

The snippet from the doc raises a ValueError: Count of values doesn’t match stems

Edit: Ok, so the stems are actually set from the font object, and the actual values from the masters. Maybe I’m a bit sleepy yet, or this is not completely straightforward at first glance. Leaving the topic here in case anyone has the same question at some point.