def tolist(val):
if val is None:<EOL><INDENT>return None<EOL><DEDENT>try:<EOL><INDENT>val.extend([])<EOL>return val<EOL><DEDENT>except AttributeError:<EOL><INDENT>pass<EOL><DEDENT>try:<EOL><INDENT>return re.split(r'<STR_LIT>', val)<EOL><DEDENT>except TypeError:<EOL><INDENT>return list(val)<EOL><DEDENT>
Convert a value that may be a list or a (possibly comma-separated)
    string into a list. The exception: None is returned as None, not [None].

    >>> tolist(["one", "two"])
    ['one', 'two']
    >>> tolist("hello")
    ['hello']
    >>> tolist("separate,values, with, commas,  spaces , are    ,ok")
    ['separate', 'values', 'with', 'commas', 'spaces', 'are', 'ok']