def configure_remote_put(remote_url, app_id, extra_headers=None):
  """Does necessary setup to intercept PUT.

  Args:
    remote_url: The url to the remote_api handler.
    app_id: The app_id of the target app.
    extra_headers: Headers to send (for authentication).

  Raises:
    ConfigurationError: if there is a error configuring the stub.
  """
  if not app_id or not remote_url:
    raise ConfigurationError('app_id and remote_url required')



  original_datastore_stub = apiproxy_stub_map.apiproxy.GetStub('datastore_v3')
  if isinstance(original_datastore_stub, DatastorePutStub):

    logging.info('Stub is already configured. Hopefully in a matching fashion.')
    return
  datastore_stub = DatastorePutStub(remote_url, app_id, extra_headers,
                                    original_datastore_stub)
  apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', datastore_stub)
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/datastore_admin/remote_api_put_stub.py/configure_remote_put/original