'helper to fetch the set of geonetwork
groups.'

def _geonetwork_get_group_ids(self):

    get_groups_url = ('%sgeonetwork/srv/en/xml.info?%s' % (self.base, urllib.urlencode({'type': 'groups'})))
    request = urllib2.Request(get_groups_url)
    response = self.urlopen(request)
    doc = etree.fromstring(response.read())
    groups = {}
    for gp in doc.findall('groups/group'):
        groups[gp.find('name').text.lower()] = gp.attrib['id']
    return groups
