def get_format(format_type, lang=None, use_l10n=None):
 use_l10n = (use_l10n or ((use_l10n is None) and settings.USE_L10N))
 if (use_l10n and (lang is None)):
  lang = get_language()
 cache_key = (format_type, lang)
 try:
  return _format_cache[cache_key]
 except KeyError:
  pass
 val = None
 if use_l10n:
  for module in get_format_modules(lang):
   try:
    val = getattr(module, format_type)
    if (val is not None):
     break
   except AttributeError:
    pass
 if (val is None):
  if (format_type not in FORMAT_SETTINGS):
   return format_type
  val = getattr(settings, format_type)
 elif (format_type in ISO_INPUT_FORMATS.keys()):
  val = list(val)
  for iso_input in ISO_INPUT_FORMATS.get(format_type, ()):
   if (iso_input not in val):
    val.append(iso_input)
 _format_cache[cache_key] = val
 return val

def get_format ( format_type , lang = None , use_l10n = None ) : use_l10n = ( use_l10n or ( ( use_l10n is None ) and settings . USE_L10N ) ) if ( use_l10n and ( lang is None ) ) : lang = get_language ( ) cache_key = ( format_type , lang ) try : return _format_cache [ cache_key ] except KeyError : pass val = None if use_l10n : for module in get_format_modules ( lang ) : try : val = getattr ( module , format_type ) if ( val is not None ) : break except AttributeError : pass if ( val is None ) : if ( format_type not in FORMAT_SETTINGS ) : return format_type val = getattr ( settings , format_type ) elif ( format_type in ISO_INPUT_FORMATS . keys ( ) ) : val = list ( val ) for iso_input in ISO_INPUT_FORMATS . get ( format_type , ( ) ) : if ( iso_input not in val ) : val . append ( iso_input ) _format_cache [ cache_key ] = val return val
for a specific format type .