code: def compile_file(source, globals_=None):
    
    if isinstance(source, gast.AST):
      source = quoting.to_source(source)
  
    # Write source to temporary file
    tempdir = tempfile.mkdtemp()
    uuid = str(uuid4().hex[:4])
    tmpname = os.path.join(tempdir, 'tangent_%s.py' % uuid)
    with open(tmpname, 'w') as f:
      f.write(source)
  
    # Load the temporary file as a module
    module_name = 'tangent_%s' % uuid
    if six.PY3:
      spec = util.spec_from_file_location(module_name, tmpname)
      m = util.module_from_spec(spec)
      spec.loader.exec_module(m)
    else:
      m = imp.load_source(module_name, tmpname)
  
    # Update the modules namespace
    if globals_:
      m.__dict__.update(globals_)
    return m
docs: Compile by saving to file and importing that.
  
    Compiling the AST/source code this way ensures that the source code is
    readable by e.g. `pdb` or `inspect`.
  
    Args:
      source: The code to compile, either as a string or as an AST.
      globals_: A dictionary of variables that should be available as globals in
          the compiled module. They will be monkey patched after importing the
          module.
  
    Returns:
      A module object containing the compiled source code.