def tolist(val):
 if (val is None):
  return None
 try:
  val.extend([])
  return val
 except AttributeError:
  pass
 try:
  return re.split('\\s*,\\s*', val)
 except TypeError:
  return list(val)

def tolist ( val ) : if ( val is None ) : return None try : val . extend ( [ ] ) return val except AttributeError : pass try : return re . split ( '\\s*,\\s*' , val ) except TypeError : return list ( val )
convert a value that may be a list or a string into a list .