def makelist(inlist, listchar='', stringify=False, escape=False, encoding=None):
 if stringify:
  inlist = list_stringify(inlist)
 listdict = {'[': '[%s]', '(': '(%s)', '': '%s'}
 outline = []
 if (len(inlist) < 2):
  listchar = (listchar or '[')
 for item in inlist:
  if (not isinstance(item, (list, tuple))):
   if escape:
    item = quote_escape(item)
   outline.append(elem_quote(item, encoding=encoding))
  else:
   outline.append(makelist(item, (listchar or '['), stringify, escape, encoding))
 return (listdict[listchar] % ', '.join(outline))

def makelist ( inlist , listchar = '' , stringify = False , escape = False , encoding = None ) : if stringify : inlist = list_stringify ( inlist ) listdict = { '[' : '[%s]' , '(' : '(%s)' , '' : '%s' } outline = [ ] if ( len ( inlist ) < 2 ) : listchar = ( listchar or '[' ) for item in inlist : if ( not isinstance ( item , ( list , tuple ) ) ) : if escape : item = quote_escape ( item ) outline . append ( elem_quote ( item , encoding = encoding ) ) else : outline . append ( makelist ( item , ( listchar or '[' ) , stringify , escape , encoding ) ) return ( listdict [ listchar ] % ', ' . join ( outline ) )
given a list - turn it into a string that represents that list .