What is call in the Studio SDK to set the value of a custom TM attribute when saving to TM?

When the user does anything that results in saving a segment to TM, I want to intercept and set the values of custom fields on the translation unit before it is saved to TM.

How can I do that?