code: def _get_api_call(self, function_name, *args):
      
      api_call = dedent("""
          var done = arguments[0];
          KindleAPI.%(api_call)s(%(args)s).always(function(a) {
              done(a);
          });
      """) % {
          'api_call': function_name,
          'args': ', '.join(args)
      }
      script = '\n'.join((api.API_SCRIPT, api_call))
      try:
        return self._browser.execute_async_script(script)
      except TimeoutException:
        # FIXME: KCR will occassionally not load library and fall over
        raise APIError
docs: Runs an api call with javascript-formatted arguments.
  
      Args:
        function_name: The name of the KindleAPI call to run.
        *args: Javascript-formatted arguments to pass to the API call.
  
      Returns:
        The result of the API call.
  
      Raises:
        APIError: If the API call fails or times out.