def smartsplit(string, sep):
 assert (string is not None)
 if (not six.PY3):
  is_unicode = isinstance(string, unicode)
  if is_unicode:
   string = string.encode('utf8')
 l = shlex.shlex(string, posix=True)
 l.whitespace += ','
 l.whitespace_split = True
 l.quotes = ''
 if ((not six.PY3) and is_unicode):
  return map((lambda s: s.decode('utf8')), list(l))
 else:
  return list(l)

def smartsplit ( string , sep ) : assert ( string is not None ) if ( not six . PY3 ) : is_unicode = isinstance ( string , unicode ) if is_unicode : string = string . encode ( 'utf8' ) l = shlex . shlex ( string , posix = True ) l . whitespace += ',' l . whitespace_split = True l . quotes = '' if ( ( not six . PY3 ) and is_unicode ) : return map ( ( lambda s : s . decode ( 'utf8' ) ) , list ( l ) ) else : return list ( l )
split while allowing escaping .