def check_media(self, request, find_data, count=None): media = MediaEntry.find(find_data) if count is not None: assert media.count() == count if count == 0: return return media[0]