def escape(inp, quote='"'):
    """
    Escape `quote` in string `inp`.

    Example usage::

        >>> escape('hello "')
        'hello \\"'
        >>> escape('hello \\"')
        'hello \\\\"'

    Args:
        inp (str): String in which `quote` will be escaped.
        quote (char, default "): Specify which character will be escaped.

    Returns:
        str: Escaped string.
    """
    output = ''
    for c in inp:
        if c == quote:
            output += '\\'
        output += c
    return output
