code: def getvariable(name):
      
      import inspect
      fr = inspect.currentframe()
      try:
          while fr:
              fr = fr.f_back
              vars = fr.f_locals
              if name in vars:
                  return vars[name]
      except:
          pass
      return None
docs: Get the value of a local variable somewhere in the call stack.