code: def convert(cls, content, input_format, output_format):
          
          assert input_format in ('srt', 'sjson')
          assert output_format in ('srt', 'sjson')
  
          # Decode the content with utf-8-sig which will also
          # skip byte order mark(BOM) character if found.
          content = content.decode('utf-8-sig')
  
          if input_format == output_format:
              return content
  
          if input_format == 'srt':
  
              if output_format == 'sjson':
                  try:
                      # With error handling (set to 'ERROR_RAISE'), we will be getting
                      # the exception if something went wrong in parsing the transcript.
                      srt_subs = SubRipFile.from_string(content, error_handling=SubRipFile.ERROR_RAISE)
                  except Error as ex:  # Base exception from pysrt
                      raise TranscriptsGenerationException(text_type(ex))
  
                  return json.dumps(cls.generate_sjson_from_srt(srt_subs))
  
          if input_format == 'sjson':
  
              if output_format == 'srt':
                  return cls.generate_srt_from_sjson(json.loads(content))
docs: Convert transcript `content` from `input_format` to `output_format`.
  
          Arguments:
              content: Transcript content byte-stream.
              input_format: Input transcript format.
              output_format: Output transcript format.
  
          Accepted input formats: sjson, srt.
          Accepted output format: srt, sjson.
  
          Raises:
              TranscriptsGenerationException: On parsing the invalid srt
              content during conversion from srt to sjson.