def convert_repo(portfolio, file_list, output_dir, pass_list, fail_list):
	logger.debug('convert_repo(): {0} files'.format(len(file_list)))

	def is_hsbc_repo(filename):
		# if filename_from_path(filename).split('.')[0].lower().startswith('repo exposure trades and collateral position'):
		# 	return True
		# else:
		# 	return False

		# so far there is only type of REPO report (HSBC)
		return True


	output_list = []
	for filename in file_list:
		try:
			if is_hsbc_repo(filename):
				output_list.append(hsbc.toCsv(portfolio, filename, output_dir, get_filename_prefix(filename, 'hsbc_repo')))

		except:
			logger.exception('convert_repo(): {0}'.format(filename))
			fail_list.append(filename)
		else:
			pass_list.append(filename)


	return output_list
def convert_jpm2(file_list, output_dir, pass_list, fail_list):
	output_list = []
	for filename in file_list:
		try:
			output_list = output_list + \
							jpm2.toCsv(filename, output_dir, get_filename_prefix(filename, 'jpm'))
		except:
			logger.exception('convert_jpm2()')
			fail_list.append(filename)
		else:
			pass_list.append(filename)

	return output_list
def convert_citi(file_list, output_dir, pass_list, fail_list):
	output_list = []
	for filename in file_list:
		port_values = {}
		try:
			output = open_citi.open_citi(filename, port_values, output_dir, get_filename_prefix(filename, 'citi'))
			output_list = output_list + output
		except:
			logger.exception('convert_citi()')
			fail_list.append(filename)
		else:
			pass_list.append(filename)

	return output_list
def convert_cmbhk(portfolio, file_list, output_dir, pass_list, fail_list):
	logger.debug('convert_cmbhk(): {0} files'.format(len(file_list)))

	output_list = []
	for filename in file_list:
		try:
			output_list.append(cmb.toCsv(portfolio, filename, output_dir, get_filename_prefix(filename, '')))

		except:
			logger.exception('convert_cmbhk(): {0}'.format(filename))
			fail_list.append(filename)
		else:
			pass_list.append(filename)

	return output_list
def convert_dif(file_list, output_dir, pass_list, fail_list):
	output_list = []
	for filename in file_list:
		port_values = {}
		try:
			output = open_dif(filename, port_values, output_dir, get_filename_prefix(filename, ''))
			# validate_and_upload(port_values)
			output_list = output_list + output
		except:
			logger.exception('convert_dif()')
			fail_list.append(filename)
		else:
			pass_list.append(filename)

	return output_list
def convert_bochk(file_list, output_dir, pass_list, fail_list):
	output_list = []
	for filename in file_list:
		port_values = {}
		try:
			open_bochk.read_file(filename, port_values)
			output = open_bochk.write_cash_or_holding_csv(port_values, output_dir, get_filename_prefix(filename, 'bochk'))
			output_list.append(output)
		except:
			logger.exception('convert_bochk()')
			fail_list.append(filename)
		else:
			pass_list.append(filename)

	return output_list