def list_groups(name):
    '''
    Return a list of groups the named user belongs to

    :param str name:
        user name for which to list groups

    :return:
        list of groups to which the user belongs
    :rtype: list

    CLI Example:

    .. code-block:: bash

        salt '*' user.list_groups foo
    '''
    ugrp = set()
    try:
        user = info(name)['groups']
    except __HOLE__:
        return False
    for group in user:
        ugrp.add(group.strip(' *'))

    return sorted(list(ugrp))
dataset/ETHPy150Open saltstack/salt/salt/modules/win_useradd.py/list_groups