<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def top_stream(cache, user_id):
 """ Peek at the top of the stack in the cache. :param cache: werkzeug BasicCache-like object :param user_id: id of user, used as key in cache :return: top item in user's cached stack, otherwise None """

    if not user_id:
        return None
    
    stack = cache.get(user_id)
    if stack is None:
        return None
    return stack.pop()