Allows an argument to be passed either as a list of strings or a single string delimited
    by spaces and/or commas.
    >>> assert (ensure_list_if_string(['abc', 'def', '123']) ==
    ...         ensure_list_if_string('abc,def,123') ==
    ...         ensure_list_if_string('abc def 123') ==
    ...         ensure_list_if_string(', abc , def , 123  , ,') ==
    ...         ['abc', 'def', '123'])
    >>> ensure_list_if_string('')
    []

def ensure_list_if_string(x):
    """
    Allows an argument to be passed either as a list of strings or a single string delimited
    by spaces and/or commas.
    >>> assert (ensure_list_if_string(['abc', 'def', '123']) ==
    ...         ensure_list_if_string('abc,def,123') ==
    ...         ensure_list_if_string('abc def 123') ==
    ...         ensure_list_if_string(', abc , def , 123  , ,') ==
    ...         ['abc', 'def', '123'])
    >>> ensure_list_if_string('')
    []
    """
    if isinstance(x, basestring):
        x = list(filter(None, re.split('[,\s]+', x)))
    return x