code: def preview(src_path):
    ''' Generates a preview of src_path in the requested format.
    :returns: A list of preview paths, one for each page. Blank list if unsupported.
    '''
    preview = embedded_preview(src_path)
  
    if not is_valid_preview(preview):
      preview = generator_preview(src_path)
  
    if not is_valid_preview(preview):
      preview = thumbnail_preview(src_path)
  
    # Ensure the preview is returned in the right format
    if is_valid_preview(preview):
      if mimetype(preview) in [ExportMimeType.PNG]:
        return [preview]
  
      if mimetype(preview) in [ExportMimeType.PDF]:
        return to_pngs(preview)
  
    return [f preview(src_path):
    ''' Generates a preview of src_path in the requested format.
    :returns: A list of preview paths, one for each page. Blank list if unsupported.
    '''
    preview = embedded_preview(src_path)
  
    if not is_valid_preview(preview):
      preview = generator_preview(src_path)
  
    if not is_valid_preview(preview):
      preview = thumbnail_preview(src_path)
  
    # Ensure the preview is returned in the right format
    if is_valid_preview(preview):
      if mimetype(preview) in [ExportMimeType.PNG]:
        return [preview]
  
      if mimetype(preview) in [ExportMimeType.PDF]:
        return to_pngs(preview)
  
    return []
docs: Generates a preview of src_path in the requested format.
    :returns: A list of preview paths, one for each page. Blank list if unsupported.