code: def determine_repo_dir(template, abbreviations, clone_to_dir, checkout,
                         no_input, password=None):
      
      template = expand_abbreviations(template, abbreviations)
  
      if is_zip_file(template):
          unzipped_dir = unzip(
              zip_uri=template,
              is_url=is_repo_url(template),
              clone_to_dir=clone_to_dir,
              no_input=no_input,
              password=password
          )
          repository_candidates = [unzipped_dir]
          cleanup = True
      elif is_repo_url(template):
          cloned_repo = clone(
              repo_url=template,
              checkout=checkout,
              clone_to_dir=clone_to_dir,
              no_input=no_input,
          )
          repository_candidates = [cloned_repo]
          cleanup = False
      else:
          repository_candidates = [
              template,
              os.path.join(clone_to_dir, template)
          ]
          cleanup = False
  
      for repo_candidate in repository_candidates:
          if repository_has_cookiecutter_json(repo_candidate):
              return repo_candidate, cleanup
  
      raise RepositoryNotFound(
          'A valid repository for "{}" could not be found in the following '
          'locations:\n{}'.format(
              template,
              '\n'.join(repository_candidates)
          )
      )
docs: Locate the repository directory from a template reference.
  
      Applies repository abbreviations to the template reference.
      If the template refers to a repository URL, clone it.
      If the template is a path to a local repository, use it.
  
      :param template: A directory containing a project template directory,
          or a URL to a git repository.
      :param abbreviations: A dictionary of repository abbreviation
          definitions.
      :param clone_to_dir: The directory to clone the repository into.
      :param checkout: The branch, tag or commit ID to checkout after clone.
      :param no_input: Prompt the user at command line for manual configuration?
      :param password: The password to use when extracting the repository.
      :return: A tuple containing the cookiecutter template directory, and
          a boolean descriving whether that directory should be cleaned up
          after the template has been instantiated.
      :raises: `RepositoryNotFound` if a repository directory could not be found.