def call_vtk(obj, method, args=None):
    """ Invoke a method on a vtk object.

    Parameters
    ----------
    obj : object
        VTK object.
    method : str
        Method name.
    args : None ot tuple or list
        Arguments to be passed to the method.
        If None, the method is called with no arguments.

    Returns
    -------
    result : Any
        Return the results of invoking `method` with `args` on `obj`.

    Notes
    -----
    Use a tuple to pass a None to the method: (None,).

    Examples
    --------
    >>> import vtk
    >>> from brainspace.vtk_interface.wrappers.base import call_vtk
    >>> m = vtk.vtkPolyDataMapper()

    Get array id of the mapper:

    >>> call_vtk(m, 'GetArrayId', args=None)
    -1
    >>> m.GetArrayId()
    -1

    Set array id of the mapper to 2:

    >>> call_vtk(m, 'SetArrayId', args=(2,)) # same as m.SetArrayId(2)
    >>> m.GetArrayId()
    2

    """

    # Function takes no args -> use None
    # e.g., SetColorModeToMapScalars() -> colorModeToMapScalars=None
    if args is None:
        try:
            return getattr(obj, method)()
        except:
            return getattr(obj, method)(None)

    if isinstance(args, dict):
        return getattr(obj, method)(**args)

    # If iterable try first with multiple arguments
    if isinstance(args, (tuple, list)):
        try:
            return getattr(obj, method)(*args)
        except TypeError:
            pass

    return getattr(obj, method)(args)