code: def to_list(var):
      
      if var is None:
          return []
      if isinstance(var, str):
          var = var.split('\n')
      elif not isinstance(var, list):
          try:
              var = list(var)
          except TypeError:
              raise ValueError("{} cannot be converted to the list.".format(var))
      return var
docs: Checks if given value is a list, tries to convert, if it is not.