<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def groups(self, query=None, exclude=None, maxResults=9999):
 """Return a list of groups matching the specified criteria. :param query: filter groups by name with this string :type query: Optional[str] :param exclude: filter out groups by name with this string :type exclude: Optional[Any] :param maxResults: maximum results to return. (Default: 9999) :type maxResults: int :rtype: List[str] """

        params = {}
        groups = []
        if query is not None:
            params['query'] = query
        if exclude is not None:
            params['exclude'] = exclude
        if maxResults is not None:
            params['maxResults'] = maxResults
        for group in self._get_json('groups/picker', params=params)['groups']:
            groups.append(group['name'])
        return sorted(groups)