converts an object to a list

        >>> to_list(1)
        [1]
        >>> to_list([1,2,3])
        [1, 2, 3]
        >>> to_list(("a", "b", "c"))
        ['a', 'b', 'c']
        >>> to_list(dict(a=1, b=2))
        [{'a': 1, 'b': 2}]
        >>> to_list(None)
        []
        >>> to_list("['a', 'b', 'c']")
        ['a', 'b', 'c']
        >>> to_list("")
        ['']
        >>> to_list([])
        []
        >>> to_list("['[]']")
        ['[]']
        >>> sorted(to_list(set(["a", "b", "c"])))
        ['a', 'b', 'c']

def to_list(thing):
    """ converts an object to a list

        >>> to_list(1)
        [1]
        >>> to_list([1,2,3])
        [1, 2, 3]
        >>> to_list(("a", "b", "c"))
        ['a', 'b', 'c']
        >>> to_list(dict(a=1, b=2))
        [{'a': 1, 'b': 2}]
        >>> to_list(None)
        []
        >>> to_list("['a', 'b', 'c']")
        ['a', 'b', 'c']
        >>> to_list("")
        ['']
        >>> to_list([])
        []
        >>> to_list("['[]']")
        ['[]']
        >>> sorted(to_list(set(["a", "b", "c"])))
        ['a', 'b', 'c']
    """
    if thing is None:
        return []
    if isinstance(thing, set):
        return list(thing)
    if isinstance(thing, types.StringTypes):
        if thing.startswith("["):
            # handle a list inside a string coming from the batch navigation
            return ast.literal_eval(thing)
    if not (is_list(thing) or is_tuple(thing)):
        return [thing]
    return list(thing)