def app_restore(storage, bucket_name=None):
  # Create app backups dir if it doesn't exist.
  if not makedirs(APP_BACKUP_DIR_LOCATION):
    logging.warning("Dir '{0}' already exists. Skipping dir creation...".
      format(APP_BACKUP_DIR_LOCATION))

  # Download from GCS to backups location.
  if storage == StorageTypes.GCS:
    objects = gcs_helper.list_bucket(bucket_name)
    for app_path in objects:
      if not app_path.startswith(gcs_helper.APPS_GCS_PREFIX):
        continue

      # Only keep the relative name of the app file.
      # E.g. myapp.tar.gz (app_file) out of apps/myapp.tar.gz (app_path)
      app_file = app_path[len(gcs_helper.APPS_GCS_PREFIX):]
      source = 'gs://{0}/{1}'.format(bucket_name, app_path)
      destination = '{0}/{1}'.format(APP_BACKUP_DIR_LOCATION, app_file)
      if not gcs_helper.download_from_bucket(source, destination):
        logging.error("Error while downloading '{0}' from GCS.".format(source))
        delete_app_tars(APP_BACKUP_DIR_LOCATION)
        return False

  # Deploy apps.
  apps_to_deploy = [os.path.join(APP_BACKUP_DIR_LOCATION, app) for app in
    os.listdir(APP_BACKUP_DIR_LOCATION)]
  if not deploy_apps(apps_to_deploy):
    logging.error("Failed to successfully deploy one or more of the "
      "following apps: {0}".format(apps_to_deploy))
    return False

  return True
Checks to see if the given name is in "ASCII" format.
dataset/ETHPy150Open AppScale/appscale/AppDB/backup/backup_recovery_helper.py/app_restore--crossover with--dataset/ETHPy150Open Djacket/djacket/core/backend/repository/forms.py/ascii_validator