def make_sidenotes(text):
    """
    Picks sidenotes wrapped by `!sidenote` `!endsidenote` inside
    text
    """

    if text.find("!sidenote") > -1:
        start = text.find("!sidenote")
        end = text.find("!endsidenote")
        note = text[start:end].strip("!sidenote")
        sidenote = r"\marginnote{"+ note.strip() +"}"
        text = text[:start] + sidenote + text[end:].strip("!sidenote")

    return text