def canonicalTitle(title, lang=None, imdbIndex=None):
 isUnicode = isinstance(title, unicode)
 articlesDicts = linguistics.articlesDictsForLang(lang)
 try:
  if (title.split(', ')[(-1)].lower() in articlesDicts[isUnicode]):
   return title
 except IndexError:
  pass
 if isUnicode:
  _format = u'%s%s, %s'
 else:
  _format = '%s%s, %s'
 ltitle = title.lower()
 if imdbIndex:
  imdbIndex = (' (%s)' % imdbIndex)
 else:
  imdbIndex = ''
 spArticles = linguistics.spArticlesForLang(lang)
 for article in spArticles[isUnicode]:
  if ltitle.startswith(article):
   lart = len(article)
   title = (_format % (title[lart:], imdbIndex, title[:lart]))
   if (article[(-1)] == ' '):
    title = title[:(-1)]
   break
 return title

def canonicalTitle ( title , lang = None , imdbIndex = None ) : isUnicode = isinstance ( title , unicode ) articlesDicts = linguistics . articlesDictsForLang ( lang ) try : if ( title . split ( ', ' ) [ ( - 1 ) ] . lower ( ) in articlesDicts [ isUnicode ] ) : return title except IndexError : pass if isUnicode : _format = u'%s%s, %s' else : _format = '%s%s, %s' ltitle = title . lower ( ) if imdbIndex : imdbIndex = ( ' (%s)' % imdbIndex ) else : imdbIndex = '' spArticles = linguistics . spArticlesForLang ( lang ) for article in spArticles [ isUnicode ] : if ltitle . startswith ( article ) : lart = len ( article ) title = ( _format % ( title [ lart : ] , imdbIndex , title [ : lart ] ) ) if ( article [ ( - 1 ) ] == ' ' ) : title = title [ : ( - 1 ) ] break return title
return the title in the canonic format movie title .