code: def get_groups(user=None):
      
      portal_groups = get_tool("portal_groups")
      user = get_user(user)
      if user is None:
          return []
      return portal_groups.getGroupsForPrincipal(user)
docs: Return the groups of the user
  
      :param user: A user id, memberdata object or None for the current user
      :returns: List of groups