code: def get_global_vars(func):
      
      closure = getclosurevars(func)
      if closure['nonlocal']:
          raise TypeError("Can't launch a job with closure variables: %s" %
                          closure['nonlocals'].keys())
      globalvars = dict(modules={},
                        functions={},
                        vars={})
      for name, value in closure['global'].items():
          if inspect.ismodule(value):  # TODO: deal FUNCTIONS from closure
              globalvars['modules'][name] = value.__name__
          elif inspect.isfunction(value) or inspect.ismethod(value):
              globalvars['functions'][name] = value
          else:
              globalvars['vars'][name] = value
  
      return globalvars
docs: Store any methods or variables bound from the function's closure
  
      Args:
          func (function): function to inspect
  
      Returns:
          dict: mapping of variable names to globally bound VARIABLES