def mb_call(func, *args, **kwargs):
 try:
  return func(*args, **kwargs)
 except musicbrainzngs.AuthenticationError:
  raise ui.UserError(u'authentication with MusicBrainz failed')
 except (musicbrainzngs.ResponseError, musicbrainzngs.NetworkError) as exc:
  raise ui.UserError(u'MusicBrainz API error: {0}'.format(exc))
 except musicbrainzngs.UsageError:
  raise ui.UserError(u'MusicBrainz credentials missing')

def mb_call ( func , * args , ** kwargs ) : try : return func ( * args , ** kwargs ) except musicbrainzngs . AuthenticationError : raise ui . UserError ( u'authentication with MusicBrainz failed' ) except ( musicbrainzngs . ResponseError , musicbrainzngs . NetworkError ) as exc : raise ui . UserError ( u'MusicBrainz API error: {0}' . format ( exc ) ) except musicbrainzngs . UsageError : raise ui . UserError ( u'MusicBrainz credentials missing' )
call a musicbrainz api function and catch exceptions .