def get_formatted_string(string_type, string, fallback, case):
 if (string is not None):
  if case.formatted(string):
   return string
 else:
  string = case.convert(fallback)
  question = (u'Do you wish to use %s as the %s?' % (string, string_type))
  if (not get_confirmation(question)):
   string = input((u'Please input a %s: ' % string_type))
 while (not case.formatted(string)):
  print((u"'%s' is not a valid %s." % (string, string_type)))
  string = input((u'Please input a valid %s: ' % string_type))
 return string

def get_formatted_string ( string_type , string , fallback , case ) : if ( string is not None ) : if case . formatted ( string ) : return string else : string = case . convert ( fallback ) question = ( u'Do you wish to use %s as the %s?' % ( string , string_type ) ) if ( not get_confirmation ( question ) ) : string = input ( ( u'Please input a %s: ' % string_type ) ) while ( not case . formatted ( string ) ) : print ( ( u"'%s' is not a valid %s." % ( string , string_type ) ) ) string = input ( ( u'Please input a valid %s: ' % string_type ) ) return string
given the name of the type of string .