def File(filename, options=None, easy=False):
 if (options is None):
  from mutagen.asf import ASF
  from mutagen.apev2 import APEv2File
  from mutagen.flac import FLAC
  if easy:
   from mutagen.easyid3 import EasyID3FileType as ID3FileType
  else:
   from mutagen.id3 import ID3FileType
  if easy:
   from mutagen.mp3 import EasyMP3 as MP3
  else:
   from mutagen.mp3 import MP3
  from mutagen.oggflac import OggFLAC
  from mutagen.oggspeex import OggSpeex
  from mutagen.oggtheora import OggTheora
  from mutagen.oggvorbis import OggVorbis
  from mutagen.oggopus import OggOpus
  if easy:
   from mutagen.trueaudio import EasyTrueAudio as TrueAudio
  else:
   from mutagen.trueaudio import TrueAudio
  from mutagen.wavpack import WavPack
  if easy:
   from mutagen.easymp4 import EasyMP4 as MP4
  else:
   from mutagen.mp4 import MP4
  from mutagen.musepack import Musepack
  from mutagen.monkeysaudio import MonkeysAudio
  from mutagen.optimfrog import OptimFROG
  from mutagen.aiff import AIFF
  from mutagen.aac import AAC
  options = [MP3, TrueAudio, OggTheora, OggSpeex, OggVorbis, OggFLAC, FLAC, AIFF, APEv2File, MP4, ID3FileType, WavPack, Musepack, MonkeysAudio, OptimFROG, ASF, OggOpus, AAC]
 if (not options):
  return None
 fileobj = open(filename, 'rb')
 try:
  header = fileobj.read(128)
  results = [(Kind.score(filename, fileobj, header), Kind.__name__) for Kind in options]
 finally:
  fileobj.close()
 results = list(zip(results, options))
 results.sort()
 ((score, name), Kind) = results[(-1)]
 if (score > 0):
  return Kind(filename)
 else:
  return None

def File ( filename , options = None , easy = False ) : if ( options is None ) : from mutagen . asf import ASF from mutagen . apev2 import APEv2File from mutagen . flac import FLAC if easy : from mutagen . easyid3 import EasyID3FileType as ID3FileType else : from mutagen . id3 import ID3FileType if easy : from mutagen . mp3 import EasyMP3 as MP3 else : from mutagen . mp3 import MP3 from mutagen . oggflac import OggFLAC from mutagen . oggspeex import OggSpeex from mutagen . oggtheora import OggTheora from mutagen . oggvorbis import OggVorbis from mutagen . oggopus import OggOpus if easy : from mutagen . trueaudio import EasyTrueAudio as TrueAudio else : from mutagen . trueaudio import TrueAudio from mutagen . wavpack import WavPack if easy : from mutagen . easymp4 import EasyMP4 as MP4 else : from mutagen . mp4 import MP4 from mutagen . musepack import Musepack from mutagen . monkeysaudio import MonkeysAudio from mutagen . optimfrog import OptimFROG from mutagen . aiff import AIFF from mutagen . aac import AAC options = [ MP3 , TrueAudio , OggTheora , OggSpeex , OggVorbis , OggFLAC , FLAC , AIFF , APEv2File , MP4 , ID3FileType , WavPack , Musepack , MonkeysAudio , OptimFROG , ASF , OggOpus , AAC ] if ( not options ) : return None fileobj = open ( filename , 'rb' ) try : header = fileobj . read ( 128 ) results = [ ( Kind . score ( filename , fileobj , header ) , Kind . __name__ ) for Kind in options ] finally : fileobj . close ( ) results = list ( zip ( results , options ) ) results . sort ( ) ( ( score , name ) , Kind ) = results [ ( - 1 ) ] if ( score > 0 ) : return Kind ( filename ) else : return None
backwards compat .