@classmethod
  def extract_app_to_dir(cls, archive_location, extract_command, is_verbose):
    """Extracts the given file to a randomly generated location and returns that
    location.

    Args:
      archive_location: The location on the local filesystem where the file
        to extract can be found.
      extract_command: The command and flags necessary to extract the archived
        file.
      is_verbose: A bool that indicates if we should print the command we
        execute to stdout.
    Returns:
      The location on the local filesystem where the file was extracted
        to.
    """
    extracted_location = "/tmp/appscale-app-{0}".format(str(uuid.uuid4()) \
      .replace('-', '')[:8])

    os.mkdir(extracted_location)
    cls.shell("cd {0} && {1} '{2}'".format(extracted_location, extract_command,
      os.path.abspath(archive_location)), is_verbose)

    file_list = os.listdir(extracted_location)
    if len(file_list) > 0:
      # Users can upload an archive containing their application or a directory
      # containing their application. To see which case this is, we count how
      # many files are present in the archive. As some platforms will inject a
      # dot file into every directory, we shouldn't consider those when trying
      # to find out if this archive is just a directory or not (because the
      # presence of the dot file will cause our count to be incorrect).
      file_list[:] = [itm for itm in file_list if itm[0] != '.']
      included_dir = extracted_location + os.sep + file_list[0]
      if len(file_list) == 1 and os.path.isdir(included_dir):
        extracted_location = included_dir

    return extracted_location
dataset/ETHPy150Open AppScale/appscale-tools/lib/local_state.py/LocalState.extract_app_to_dir/original