def split_title_year(title):
 if (not title):
  return
 if (not re.search(u'\\d{4}', title)):
  return (title, None)
 match = re.search(u'(.*?)\\(?(\\d{4})?\\)?$', title)
 title = match.group(1).strip()
 if match.group(2):
  year = int(match.group(2))
 else:
  year = None
 return (title, year)

def split_title_year ( title ) : if ( not title ) : return if ( not re . search ( u'\\d{4}' , title ) ) : return ( title , None ) match = re . search ( u'(.*?)\\(?(\\d{4})?\\)?$' , title ) title = match . group ( 1 ) . strip ( ) if match . group ( 2 ) : year = int ( match . group ( 2 ) ) else : year = None return ( title , year )
splits title containing a year into a title .