def get_file_type(file): if 'video' in file.type: return 'video' elif 'audio' in file.type: return 'audio' else: return None