code: def _are_requirejs_deps_loaded(browser, deps):
      
  
      # This is a little complicated
      #
      # We're going to use `execute_async_script` to give control to
      # the browser.  The browser indicates that it wants to return
      # control to us by calling `callback`, which is the last item
      # in the global `arguments` array.
      #
      # We install a RequireJS module with the dependencies we want
      # to ensure are loaded.  When our module loads, we return
      # control to the test suite.
      script = dedent(u"""
          // Retrieve the callback function used to return control to the test suite
          var callback = arguments[arguments.length - 1];
  
          // If RequireJS isn't defined, then return immediately
          if (!window.require) {{
              callback("RequireJS not defined");
          }}
  
          // Otherwise, install a RequireJS module that depends on the modules
          // we're waiting for.
          else {{
  
              // Catch errors reported by RequireJS
              requirejs.onError = callback;
  
              // Install our module
              require({deps}, function() {{
                  callback('Success');
              }});
          }}
      """).format(deps=json.dumps(list(deps)))
  
      # Set a timeout to ensure we get control back
      browser.set_script_timeout(30)
  
      # Give control to the browser
      # `result` will be the argument passed to the callback function
      try:
          result = browser.execute_async_script(script)
          return result == 'Success'
  
      except TimeoutException:
          return False
docs: Return a boolean indicating whether all the RequireJS
      dependencies `deps` have loaded on the current page.
  
      `browser` is a WebDriver instance.