def METHOD_NAME(self):
    def foobar():
        raise ValueError('foobar: spam ham!')
    exc = None
    try:
        foobar()
    except Exception as ex:
        exc = ex
    return markup.serialize(exc, ctx=markup.Context())