def _as_inline_code(text):
    """Apply inline code markdown to text

    Wrap text in backticks, escaping any embedded backticks first.

    E.g:

        >>> print(_as_inline_code("foo [`']* bar"))
        `foo [\\`']* bar`

    """
    escaped = text.replace("`", r"\`")
    return f"`{escaped}`"