import io


def formatted_text_to_markdown(ft):
    """
    Simple method to convert formatted text to markdown. Does not escape special characters.
    """
    s = io.StringIO()
    for f, t in ft:
        if f == "":
            s.write(t)
        elif f == "underline":
            s.write(f"__{t}__")
        elif f == "bold":
            s.write(f"**{t}**")
        elif f == "italic":
            s.write(f"*{t}*")
        else:
            raise RuntimeError(f"unknown formatting: {f}")
    return s.getvalue()