def format_list(lst, locale=DEFAULT_LOCALE):
 locale = Locale.parse(locale)
 if (not lst):
  return ''
 if (len(lst) == 1):
  return lst[0]
 if (len(lst) == 2):
  return locale.list_patterns['2'].format(*lst)
 result = locale.list_patterns['start'].format(lst[0], lst[1])
 for elem in lst[2:(-1)]:
  result = locale.list_patterns['middle'].format(result, elem)
 result = locale.list_patterns['end'].format(result, lst[(-1)])
 return result

def format_list ( lst , locale = DEFAULT_LOCALE ) : locale = Locale . parse ( locale ) if ( not lst ) : return '' if ( len ( lst ) == 1 ) : return lst [ 0 ] if ( len ( lst ) == 2 ) : return locale . list_patterns [ '2' ] . format ( * lst ) result = locale . list_patterns [ 'start' ] . format ( lst [ 0 ] , lst [ 1 ] ) for elem in lst [ 2 : ( - 1 ) ] : result = locale . list_patterns [ 'middle' ] . format ( result , elem ) result = locale . list_patterns [ 'end' ] . format ( result , lst [ ( - 1 ) ] ) return result
format a list of traceback entry tuples for printing .