def _preferred_string(value1, value2):
 if (value1 == value2):
  return value1
 if (value1.istitle() and (not value2.istitle())):
  return value1
 if ((not value1.isupper()) and value2.isupper()):
  return value1
 if ((not value1.isupper()) and value1[0].isupper() and (not value2[0].isupper())):
  return value1
 if (_count_title_words(value1) > _count_title_words(value2)):
  return value1
 return value2

def _preferred_string ( value1 , value2 ) : if ( value1 == value2 ) : return value1 if ( value1 . istitle ( ) and ( not value2 . istitle ( ) ) ) : return value1 if ( ( not value1 . isupper ( ) ) and value2 . isupper ( ) ) : return value1 if ( ( not value1 . isupper ( ) ) and value1 [ 0 ] . isupper ( ) and ( not value2 [ 0 ] . isupper ( ) ) ) : return value1 if ( _count_title_words ( value1 ) > _count_title_words ( value2 ) ) : return value1 return value2
retrieves preferred title from both values .