def extern_val_to_str(self, context_handle, val):
    """Given a Handle for `obj`, write str(obj) and return it."""
    c = self._ffi.from_handle(context_handle)
    v = c.from_value(val[0])
    # Consistently use the empty string to indicate None.
    v_str = '' if v is None else text_type(v)
    return c.utf8_buf(v_str)
Given a Handle for `obj`, write str(obj) and return it.