def wrap_pointer_return(func):
    """If the returned value is a NULL pointer return None instead"""

    def wrapper(*args, **kwargs):
        ret = func(*args, **kwargs)
        if not ret:
            return None
        return ret
    return wrapper