def localize_input(value, default=None):
 if isinstance(value, (decimal.Decimal, float, int, long)):
  return number_format(value)
 if isinstance(value, datetime.datetime):
  value = datetime_safe.new_datetime(value)
  format = smart_str((default or get_format('DATETIME_INPUT_FORMATS')[0]))
  return value.strftime(format)
 elif isinstance(value, datetime.date):
  value = datetime_safe.new_date(value)
  format = smart_str((default or get_format('DATE_INPUT_FORMATS')[0]))
  return value.strftime(format)
 elif isinstance(value, datetime.time):
  format = smart_str((default or get_format('TIME_INPUT_FORMATS')[0]))
  return value.strftime(format)
 return value

def localize_input ( value , default = None ) : if isinstance ( value , ( decimal . Decimal , float , int , long ) ) : return number_format ( value ) if isinstance ( value , datetime . datetime ) : value = datetime_safe . new_datetime ( value ) format = smart_str ( ( default or get_format ( 'DATETIME_INPUT_FORMATS' ) [ 0 ] ) ) return value . strftime ( format ) elif isinstance ( value , datetime . date ) : value = datetime_safe . new_date ( value ) format = smart_str ( ( default or get_format ( 'DATE_INPUT_FORMATS' ) [ 0 ] ) ) return value . strftime ( format ) elif isinstance ( value , datetime . time ) : format = smart_str ( ( default or get_format ( 'TIME_INPUT_FORMATS' ) [ 0 ] ) ) return value . strftime ( format ) return value
checks if an input value is a localizable type and returns it formatted with the appropriate formatting string of the current locale .