def call_instance_method(instance, name, args, kwargs):
    """indirect caller for instance methods for multiprocessing

    Args:
        instance: the instance to call method with
        name (str): method name to call
        args (tuple or None): arguments to be passed to getattr(instance, name)
        kwargs (dict or None): kwargs to be passed to getattr(instance, name)

    Returns:
        the returned values of getattr(instance, name)
    """
    if args is None:
        args = ()
    if kwargs is None:
        kwargs = {}
    return getattr(instance, name)(*args, **kwargs)