code: def list_groups(name):
      '''
      Return a list of groups the named user belongs to
  
      Args:
          name (str): The user name for which to list groups
  
      Returns:
          list: A list of groups to which the user belongs
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' user.list_groups foo
      '''
      if six.PY2:
          name = _to_unicode(name)
  
      ugrp = set()
      try:
          user = info(name)['groups']
      except KeyError:
          return False
      for group in user:
          ugrp.add(group.strip(' *'))
  
      return sorted(list(ugrp)f list_groups(name):
      '''
      Return a list of groups the named user belongs to
  
      Args:
          name (str): The user name for which to list groups
  
      Returns:
          list: A list of groups to which the user belongs
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' user.list_groups foo
      '''
      if six.PY2:
          name = _to_unicode(name)
  
      ugrp = set()
      try:
          user = info(name)['groups']
      except KeyError:
          return False
      for group in user:
          ugrp.add(group.strip(' *'))
  
      return sorted(list(ugrp))
docs: Return a list of groups the named user belongs to
  
      Args:
          name (str): The user name for which to list groups
  
      Returns:
          list: A list of groups to which the user belongs
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' user.list_groups foo