def to_list(obj, key=None):
    """ to_list(obj) returns obj if obj is a list, else [obj, ].
    to_list(obj, key) returns to_list(obj[key]) if key is in obj,
    else [].
    """
    if key is None:
        return obj if isinstance(obj, list) else [obj]
    else:
        return to_list(obj[key]) if key in obj else []