def listfy(data):
 if isinstance(data, basestring):
  data = data.split(',')
 elif (not isinstance(data, list)):
  data = [data]
 return data

def listfy ( data ) : if isinstance ( data , basestring ) : data = data . split ( ',' ) elif ( not isinstance ( data , list ) ) : data = [ data ] return data
check and convert data to list .