import inspect


def pggui(name = None, **kwargs):
    """
    Add _pggui_name to a routine so it will be identified as a pggui function
    :param name: The name it should appear as in the function list. Will use func name if none supplied.
    :param kwargs: Overrides for function params - dict, list, tuple, enum, or callable
    """
    if inspect.isroutine(name):
        return pggui()(name)
    def decorator(func):
        for kwarg in kwargs:
            kwarg_name = f'_pggui_{kwarg}'
            kwarg_value = kwargs[kwarg]
            setattr(func, kwarg_name, kwarg_value)
        func._pggui_name = func.__name__ if name is None else name
        return func
    return decorator