import asyncio
from typing import Any


def maybe_set_result(fut: asyncio.Future, result: Any) -> bool:
    """Set future result if not already done."""
    if fut is not None and not fut.done():
        fut.set_result(result)
        return True
    return False