def chgroups(name, groups, append=False):
    if isinstance(groups, six.string_types):
        groups = groups.split(',')
    ugrps = set(list_groups(name))
    if ugrps == set(groups):
        return True
    if append:
        groups += ugrps
    cmd = ['pw', 'usermod', '-G', ','.join(groups), '-n', name]
    return __salt__['cmd.retcode'](cmd, python_shell=False) == 0
:rtype: dict
dataset/ETHPy150Open saltstack/salt/salt/modules/pw_user.py/chgroups--crossover with--dataset/ETHPy150Open zbyte64/django-hyperadmin/hyperadmin/endpoints.py/BaseEndpoint.get_item_form_kwargs