from typing import Optional


def compose_tweet(text: Optional[str] = None) -> str:
    """Make a link that let's you compose a tweet

    Parameters
    ------------
    text: :class:`str`
        The pre-populated text in the tweet. If none specified the user has to write their own message.


    Returns
    ---------
    :class:`str`


    .. versionadded: 1.3.5
    """
    if text:
        text = text.replace(" ", "%20")
    return (
        "https://twitter.com/intent/tweet"
        if not text
        else f"https://twitter.com/intent/tweet" + f"?text={text}"
        if text
        else f"https://twitter.com/intent/tweet"
    )