code: def get_variables(self, sort=None, collapse_same_ident=False):
          variables = [ ]
          if collapse_same_ident:
              raise NotImplementedError()
          for var in self._variables:
              if sort == 'stack' and not isinstance(var, SimStackVariable):
                  continue
              if sort == 'reg' and not isinstance(var, SimRegisterVariable):
                  continue
              variables.append(var)
          return variables