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