def METHOD_NAME(args, appengine_path):
  """Set up environment variables and configuration files."""
  clusterfuzz_dir = os.path.abspath(os.path.join(args.directory, 'clusterfuzz'))
  # Matches startup scripts.
  os.environ['PYTHONPATH'] = ':'.join([
      os.getenv('PYTHONPATH', ''),
      appengine_path,
      os.path.join(clusterfuzz_dir, 'src'),
  ])
  os.environ['ROOT_DIR'] = clusterfuzz_dir
  if not os.getenv('BOT_NAME'):
    os.environ['BOT_NAME'] = args.name
  os.environ['LD_LIBRARY_PATH'] = '{0}:{1}'.format(
      os.path.join(clusterfuzz_dir, 'src', 'clusterfuzz', '_internal',
                   'scripts'), os.getenv('LD_LIBRARY_PATH', ''))
  tmpdir = os.path.join(clusterfuzz_dir, 'bot_tmpdir')
  if not os.path.exists(tmpdir):
    os.mkdir(tmpdir)
  os.environ['TMPDIR'] = tmpdir
  os.environ['BOT_TMPDIR'] = tmpdir
  os.environ['KILL_STALE_INSTANCES'] = 'False'
  os.environ['LOCAL_DEVELOPMENT'] = 'True'
  os.environ['DATASTORE_EMULATOR_HOST'] = constants.DATASTORE_EMULATOR_HOST
  os.environ['PUBSUB_EMULATOR_HOST'] = constants.PUBSUB_EMULATOR_HOST
  os.environ['APPLICATION_ID'] = constants.TEST_APP_ID
  if not os.getenv('UNTRUSTED_WORKER'):
    local_gcs_buckets_path = os.path.abspath(
        os.path.join(args.server_storage_path, 'local_gcs'))
    assert os.path.exists(local_gcs_buckets_path), (
        'Server storage path not found, make sure to start run_server with '
        'the same storage path.')
    os.environ['LOCAL_GCS_BUCKETS_PATH'] = local_gcs_buckets_path
  if args.android_serial:
    if not os.getenv('OS_OVERRIDE'):
      os.environ['OS_OVERRIDE'] = 'ANDROID'
    os.environ['ANDROID_SERIAL'] = args.android_serial