def convert_files_to_filenames(answers):
 new_answers = dict()
 for answer_id in answers.keys():
  answer = answers[answer_id]
  if is_list_of_files(answer):
   new_answers[answer_id] = [f.name for f in answer]
  else:
   new_answers[answer_id] = answers[answer_id]
 return new_answers

def convert_files_to_filenames ( answers ) : new_answers = dict ( ) for answer_id in answers . keys ( ) : answer = answers [ answer_id ] if is_list_of_files ( answer ) : new_answers [ answer_id ] = [ f . name for f in answer ] else : new_answers [ answer_id ] = answers [ answer_id ] return new_answers
check for file objects in the dict of submitted answers .