# Copyright (c) 2023 CloudZero - ALL RIGHTS RESERVED - PROPRIETARY AND CONFIDENTIAL
# Unauthorized copying of this file and/or project, via any medium is strictly prohibited.
# Direct all questions to legal@cloudzero.com
from typing import Optional, TypeVar

T = TypeVar('T')


def coalesce(*values: Optional[T]) -> Optional[T]:
    return next((v for v in values if v is not None), None)
