def quote_rst(line):
    """Convert special characters for RST output."""

    line = line.replace('\\', '\\\\').replace('`', '\\`').replace('*', '\\*')

    if 'DEPRECATED!' in line:
        line = line.replace('DEPRECATED!', '**DEPRECATED!**')
    elif 'DEPRECATED' in line:
        line = line.replace('DEPRECATED', '**DEPRECATED**')

    if 'env[' in line:
        line = line.replace('env[', '``env[').replace(']', ']``')
        # work around for "Default=env[...]" at cinder
        line = line.replace('=``', '= ``')

    return line