from typing import Union
import random


def getdelay(base=1.5, offset=0.5) -> Union[float, int]:
    """Get random delay based on provided number.

    Keyword Arguments:
        base {float/int} -- a number to base randomizing on (default: {1.5})
        offset {float/int} -- randomizing offset (default: {1.5})
    """
    if type(base) is float and type(offset) is float:
        delay = random.uniform(base - offset, base + offset)
    elif type(base) is int and type(offset) is int:
        delay = random.randint(base - offset, base + offset)
    else:
        raise ValueError("Excpected both arguments either of type 'int' or type 'float'. "
                         + f" Got base: {type(base)}, offset: {type(offset)}")
    return delay