Loads into global namespace the symbols listed in {slist}
      from the GDX listed in {gpaths}.
      If {reducel}==True, filter the dataset on 'l' entries only.
      If {remove_underscore}==True, symbols are loaded into the global
      namespace with their names without underscores.

def gload(smatch, gpaths=None, glabels=None, filt=None, reducel=False,
          remove_underscore=True, clear=True, single=True, reshape=RESHAPE_DEFAULT,
          idxlower=True, returnfirst=False, lowercase=True, lamb=None, verbose=True,
          idval=None):
      """
      Loads into global namespace the symbols listed in {slist}
      from the GDX listed in {gpaths}.
      If {reducel}==True, filter the dataset on 'l' entries only.
      If {remove_underscore}==True, symbols are loaded into the global
      namespace with their names without underscores.
      """
      # Normalize the match string for symbols
      if smatch[0] == '@':
          returnfirst = True
          smatch = smatch[1:]
      smatch = expandmatch(smatch)
      # Build gdxobj list and
      if isinstance(gpaths,list) and isinstance(gpaths[0],GdxFile):
          gpaths = [g.internal_filename for g in gpaths]
          gdxobjs = gpaths
      elif not gpaths is None:
          gpaths = expandlist(gpaths)
          gdxobjs = [GdxFile(g) for g in gpaths]
      else:
          gpaths = gload.last_gpaths
          gdxobjs = [GdxFile(g) for g in gpaths]
          glabels = gload.last_glabels
      # Normalize the list of labels for gdxs
      gload.last_gpaths = gpaths
      gload.last_glabels = glabels
      glabels = expandlist(glabels,gpaths)
      all_symbols = set()
      for g in gdxobjs:
          all_symbols |= set([x.name for x in g.get_symbols_list()])
      ng = len(gpaths)
      nax = 0
      if verbose: print(smatch)
      svar2ret = []
      for s in all_symbols:
            m = re.match(smatch,s, re.M|re.I)
            if not m:
                continue
            if verbose: print('\n<<< %s >>>' % s)
            sdata = {}
            svar = None
            validgdxs = []
            for ig,g in enumerate(gpaths):
                fname, fext = os.path.splitext(g)
                if glabels == None:
                    gid = fname
                else:
                    if isinstance(glabels,int):
                        gid = 'g%d' % (ig+glabels)
                    else:
                        gid = glabels[ig]
                try:
                    sdata_curr = gdxobjs[ig].query(s,filt=filt,reshape=reshape,idval=idval,idxlower=idxlower)
                    sdata[gid] = sdata_curr
                except Exception as e:
                    #traceback.print_exc()
                    if verbose:
                        print_traceback(e)
                        print('WARNING: Missing "%s" from "%s"' % (s,gid))
                    continue
                validgdxs.append(gid)
            nvg = len(validgdxs)
            if nvg>1:
                if isinstance(sdata_curr, pd.Index):
                    df = pd.concat({gid: pd.Series(1, x) for gid, x in sdata.items()}, keys=validgdxs).index
                elif (reshape==RESHAPE_PANEL):
                    raise NotImplementedError('Panels are obsolete')
                else:
                    if isinstance(sdata_curr, float):
                        df = pd.Series(sdata)[validgdxs]
                    else:
                        df = pd.concat(sdata, keys=validgdxs)
                    if reshape==RESHAPE_NONE:
                        df.reset_index(inplace=True)
                        col2drop = df.columns[1]
                        df.drop(col2drop, axis=1, inplace=True)
                        ncols = len(df.columns)
                        df.columns = ['s{}'.format(x) for x in range(ncols-1)] + ['val',]
                    elif reshape>=RESHAPE_SERIES:
                        for i in range(len(df.index.levels)):
                            df.index.levels[i].name = 's{}'.format(i)
                        if reshape>=RESHAPE_FRAME:
                            try:
                                df.columns.name = 's{}'.format(i+1)
                                df = df.stack().unstack(0)
                            except:
                                df = df.unstack(0)
            else:
                df = sdata_curr
            try:
                df.name = s
            except:
                pass
            svar = df
            if remove_underscore:
                  s = s.replace('','')
            if lowercase:
                s = s.lower()
            if not lamb is None:
                svar = lamb(svar)
            if not returnfirst:
                if not clear:
                    try:
                        sold = __builtins__[s]
                        if len(sold.shape) == len(svar.shape):
                            if verbose: print('Augmenting',s)
                            for c in svar.axes[0]:
                                sold[c] = svar[c]
                            svar = sold
                    except:
                        pass
                else:
                    __builtins__[s] = svar


            logprint = logger.info if verbose else logger.debug
            if isinstance(svar, pd.DataFrame):
                logprint('Rows   : {} ... {}'.format(str(svar.index[0]), str(svar.index[-1])))
                colwidth = np.max([len(str(svar.columns[i])) for i in range(len(svar.columns))])
                logprint('Columns: {}'.format('\n         '.join([('{:<%d} = {} ... {}'%colwidth).format(
                    str(svar.columns[i]), svar.iloc[0,i], svar.iloc[-1,i]) for i in range(len(svar.columns))])))
            elif isinstance(svar, pd.Series):
                logprint('Index  : {} ... {}'.format(str(svar.index[0]), str(svar.index[-1])))
            else:
                logprint(svar)
            if returnfirst:
                svar2ret.append(svar)
      if returnfirst:
          if len(svar2ret) == 1:
              svar2ret = svar2ret[0]
          return svar2ret