def imap_helper(args):
    """
    Helper function for imap.
    This is needed since built-in multiprocessing library does not have `istarmap` function.
    If packed arguments are passed, it unpacks the arguments and pass through the function.
    Otherwise, it just pass the argument through the given function.

    Attributes:
        args: Tuple of two arguments, user-defined function and arguments to pass through.
    """
    assert len(args) == 2
    func = args[0]
    if isinstance(args[1], list) or isinstance(args[1], tuple):
        return func(*args[1])
    else:
        return func(args[1])
