from typing import Any
from typing import Callable
from typing import Sequence


def to_dtype(inp: Any, dtype: Callable) -> Any:
    """
    helper function to convert a sequence of arguments to a specific type

    Args:
        inp (Any): any object which can be converted by dtype, if sequence is detected
            dtype is applied to individual arguments
        dtype (Callable): callable to convert arguments

    Returns:
        Any: converted input
    """
    if isinstance(inp, Sequence):
        return type(inp)([dtype(i) for i in inp])
    else:
        return dtype(inp)