def collect_and_zip_files(dir_list, output_dir, zip_file_name, file_extension_list=None, file_name_list=None):
temp_list = list()<EOL>if isinstance(dir_list, list):<EOL><INDENT>for dir_name in dir_list:<EOL><INDENT>if not __os.path.isdir(dir_name):<EOL><INDENT>error = '<STR_LIT>'.format(dir_name)<EOL>LOGGER.critical(error)<EOL>raise Exception(error)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>error = '<STR_LIT>'.format(type(dir_list))<EOL>LOGGER.critical(error)<EOL>raise TypeError(error)<EOL><DEDENT>if not file_extension_list and not file_name_list:<EOL><INDENT>for dir_name in dir_list:<EOL><INDENT>temp_files_list = list_files_in_directory(dir_name)<EOL>for file_name in temp_files_list:<EOL><INDENT>temp_list.append(__os.path.join(dir_name, file_name))<EOL><DEDENT><DEDENT><DEDENT>if file_extension_list:<EOL><INDENT>if isinstance(file_extension_list, list):<EOL><INDENT>for dir_name in dir_list:<EOL><INDENT>temp_files_list = list_files_in_directory(dir_name)<EOL>for file_name in temp_files_list:<EOL><INDENT>garbage, extension = file_name.split('<STR_LIT:.>')<EOL>if extension in file_extension_list:<EOL><INDENT>temp_list.append(__os.path.join(dir_name, file_name))<EOL><DEDENT><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>error = '<STR_LIT>''<STR_LIT>'.format(type(file_extension_list))<EOL>LOGGER.critical(error)<EOL>raise TypeError(error)<EOL><DEDENT><DEDENT>if file_name_list:<EOL><INDENT>if isinstance(file_name_list, list):<EOL><INDENT>for dir_name in dir_list:<EOL><INDENT>temp_files_list = list_files_in_directory(dir_name)<EOL>for file_name in temp_files_list:<EOL><INDENT>if file_name in file_name_list:<EOL><INDENT>temp_list.append(__os.path.join(dir_name, file_name))<EOL><DEDENT><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>error = '<STR_LIT>''<STR_LIT>'.format(type(file_name_list))<EOL>LOGGER.critical(error)<EOL>raise TypeError(error)<EOL><DEDENT><DEDENT>if len(zip_file_name.split('<STR_LIT:.>')) == <NUM_LIT:2>:<EOL><INDENT>name, ext = zip_file_name.split('<STR_LIT:.>')<EOL>if ext != '<STR_LIT>':<EOL><INDENT>LOGGER.warning('<STR_LIT>'.format(zip_file_name))<EOL>zip_file_name = '<STR_LIT>'.format(name, '<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>error = '<STR_LIT>''<STR_LIT>'.format(zip_file_name)<EOL>LOGGER.critical(error)<EOL>raise NameError(error)<EOL><DEDENT>with __zipfile.ZipFile(__os.path.join(output_dir, zip_file_name), '<STR_LIT:a>') as the_zip_file:<EOL><INDENT>for file in temp_list:<EOL><INDENT>the_zip_file.write(file)<EOL><DEDENT><DEDENT>the_zip_file.close()<EOL>
Function to collect files and make a zip file
:param dir_list: A list of directories
:param output_dir: The output directory
:param zip_file_name: Zip file name
:param file_extension_list: A list of extensions of files to find
:param file_name_list: A list of file names to find
:return:
    Outputs a zip file

Note: If no file_extension_list and file_name_list are provided it will zip the entire directory.