import torch
from warnings import warn


def device_available(device: str) -> bool:
    """
    Check if the given device is available to use.
    If it is not available, a warning is given.
    :param device: device on that the training should run
    :type device: str
    :return: True, if the device is available, False otherwise
    :rtype: bool
    """
    if "cuda" in device and not torch.cuda.is_available():
        warn("CUDA device cannot be found.")
        return False
    return True