def __find_index(alig_file_pth, idx_extensions):
  """
  Find an index file for a genome alignment file in the same directory.

  :param alig_file_path: path to the alignment file.
  :param idx_extensions: check for index files with these extensions
  :return: path to first index file that matches the name of the alignment file
           and has one of the specified extensions.
  """
  if idx_extensions is None:
    return None
  base, _ = os.path.splitext(alig_file_pth)
  for idx_ext in idx_extensions:
    candidate = base + os.extsep + idx_ext
    if os.path.isfile(candidate):
      return candidate
  return None
Find an index file for a genome alignment file in the same directory.

  :param alig_file_path: path to the alignment file.
  :param idx_extensions: check for index files with these extensions
  :return: path to first index file that matches the name of the alignment file
           and has one of the specified extensions.