code: def to_split(val, split_on_comma=True):
      
      if isinstance(val, list):
          return val
      if not split_on_comma:
          return [val]
      val = val.split(',')
      if val == ['']:
          val = []
      return val
docs: Try to split a string with comma separator.
      If val is already a list return it
      If we don't have to split just return [val]
      If split gives only [''] empty it
  
      :param val: value to split
      :type val:
      :param split_on_comma:
      :type split_on_comma: bool
      :return: split value on comma
      :rtype: list
  
      >>> to_split('a,b,c')
      ['a', 'b', 'c']
  
      >>> to_split('a,b,c', False)
      ['a,b,c']
  
      >>> to_split(['a,b,c'])
      ['a,b,c']
  
      >>> to_split('')
      []