code: def get_local_references(tb, max_string_length=1000):
      
      if 'self' in tb.tb_frame.f_locals:
          _locals = [('self', repr(tb.tb_frame.f_locals['self']))]
      else:
          _locals = []
      for k, v in tb.tb_frame.f_locals.iteritems():
          if k == 'self':
              continue
          try:
              vstr = format_reference(v, max_string_length=max_string_length)
              _locals.append((k, vstr))
          except TypeError:
              pass
      return _locals
docs: Find the values of the local variables within the traceback scope.
  
      :param tb: traceback
      :return: list of tuples containing (variable name, value)