<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_or_update(cls, video, language_code, metadata, file_data=None):
 """ Create or update Transcript object. Arguments: video (Video):
 Video for which transcript is going to be saved. language_code (str):
 language code for (to be created/updated) transcript metadata (dict):
 A dict containing (to be overwritten) properties file_data (InMemoryUploadedFile):
 File data to be saved Returns: Returns a tuple of (video_transcript, created). """

        try:
            video_transcript = cls.objects.get(video=video, language_code=language_code)
            retrieved = True
        except cls.DoesNotExist:
            video_transcript = cls(video=video, language_code=language_code)
            retrieved = False

        for prop, value in six.iteritems(metadata):
            if prop in ['language_code', 'file_format', 'provider']:
                setattr(video_transcript, prop, value)

        transcript_name = metadata.get('file_name')

        try:
            if transcript_name:
                video_transcript.transcript.name = transcript_name
            elif file_data:
                with closing(file_data) as transcript_file_data:
                    file_name = '{uuid}.{ext}'.format(uuid=uuid4().hex, ext=video_transcript.file_format)
                    video_transcript.transcript.save(file_name, transcript_file_data)

            video_transcript.save()
        except Exception:
            logger.exception(
                '[VAL] Transcript save failed to storage for video_id "%s" language code "%s"',
                video.edx_video_id,
                language_code
            )
            raise

        return video_transcript, not retrieved