def checked(response):
 status_code = int(response['status'][:3])
 if (status_code == 401):
  raise Unauthorized
 if (status_code == 406):
  raise NoSession
 if (status_code == 407):
  raise DownloadLimitReached
 if (status_code == 413):
  raise InvalidImdbid
 if (status_code == 414):
  raise UnknownUserAgent
 if (status_code == 415):
  raise DisabledUserAgent
 if (status_code == 503):
  raise ServiceUnavailable
 if (status_code != 200):
  raise OpenSubtitlesError(response['status'])
 return response

def checked ( response ) : status_code = int ( response [ 'status' ] [ : 3 ] ) if ( status_code == 401 ) : raise Unauthorized if ( status_code == 406 ) : raise NoSession if ( status_code == 407 ) : raise DownloadLimitReached if ( status_code == 413 ) : raise InvalidImdbid if ( status_code == 414 ) : raise UnknownUserAgent if ( status_code == 415 ) : raise DisabledUserAgent if ( status_code == 503 ) : raise ServiceUnavailable if ( status_code != 200 ) : raise OpenSubtitlesError ( response [ 'status' ] ) return response
check a response status before returning it .