def ensure_list(obj):
        """
        null obj -> return []; 

        str, unicode, bytes, bytearray -> [obj];

        else -> list(obj)
        """
        if not obj:
            return []
        elif isinstance(obj, (str, unicode, bytes, bytearray)):
            return [obj]
        elif hasattr(obj, '__iter__') or hasattr(obj, '__getitem__'):
            return list(obj)
        else:
            return [obj]