code: def split_elements(value):
      
      l = [v.strip() for v in value.split(',')]
      if len(l) == 1:
          l = value.split()
      return l
docs: Split a string with comma or space-separated elements into a list.