private static GremlinScriptContext convertContext(final ScriptContext context) {
   if (context instanceof GremlinScriptContext) return (GremlinScriptContext) context;
   else {
     GremlinScriptContext context2 = new GremlinScriptContext();
     for (int scope : context.getScopes()) {
       context2.setBindings(context.getBindings(scope), scope);
     }
     return context2;
   }
 }
 private static void typeCastContextBindings(final ScriptContext context) {
   for (int scope : context.getScopes()) {
     Bindings bindings = context.getBindings(scope);
     if (!(bindings instanceof VariableLibrary) && null != bindings) {
       for (String key : bindings.keySet()) {
         Object object = bindings.get(key);
         if (object instanceof Atom) {
           bindings.put(key, ((Atom) object).getValue());
         }
       }
     }
   }
 }