from typing import Any
from typing import Dict


def list_instances(compute: Any, tf_vars: Dict, filter_expr: str) -> Any:
    """Get list of instances for this deployment matching the given filter."""
    result = (
        compute.instances()
        .list(project=tf_vars.get("project_id"), zone=tf_vars.get("zone"), filter=filter_expr)
        .execute()
    )
    return result["items"] if "items" in result else []