We see that the function takes a MIME handle as its parameter. It
then goes to a temporary buffer, inserts the text of the part, does some
work on the text, stores the result, goes back to the buffer it was
called from and inserts the result.

The two important helper functions here are mm-insert-part and
mm-insert-inline. The first function inserts the text of the
handle in the current buffer. It handles charset and/or content
transfer decoding. The second function just inserts whatever text you
tell it to insert, but it also sets things up so that the text can be
“undisplayed” in a convenient manner.