def _as_list(obj):
    """Ensure an object is a list."""
    if obj is None:
        return None
    elif isinstance(obj, str):
        return [obj]
    elif isinstance(obj, tuple):
        return list(obj)
    elif not hasattr(obj, '__len__'):
        return [obj]
    else:
        return obj