'Makes REST API call to query the exportgroup by name.
:param name: Name/id of the export group
:param project: Name of the project
:param tenant: Name of the tenant
:param varrayuri: URI of the virtual array
:returns: id of the export group'

def exportgroup_query(self, name, project, tenant, varrayuri=None):

    if common.is_uri(name):
        return name
    uris = self.exportgroup_list(project, tenant)
    for uri in uris:
        exportgroup = self.exportgroup_show(uri, project, tenant)
        if (exportgroup and (exportgroup['name'] == name)):
            if varrayuri:
                varrayobj = exportgroup['varray']
                if (varrayobj['id'] == varrayuri):
                    return exportgroup['id']
                else:
                    continue
            else:
                return exportgroup['id']
    raise common.CoprHdError(common.CoprHdError.NOT_FOUND_ERR, (_('Export    Group    %s:    not    found') % name))
