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]
    # Arguments are packed as a list or a tuple, so pass *args.
    if isinstance(args[1], list) or isinstance(args[1], tuple):
        return func(*(args[1]))
    # Otherwise, just pass the argument.
    else:
        return func(args[1])