import ast


def is_w_mode_open_call(node):
    """Return True if node represents `rasterio.open(path, "w", ...)`"""

    return isinstance(
        node.func, ast.Attribute
    ) and node.func.attr == "open" and isinstance(node.func.value, ast.Name) and node.func.value.id == "rasterio" and len(
        node.args
    ) > 1 and isinstance(node.args[1], ast.Str) and node.args[
        1
    ].s == "w"