<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def push_stream(cache, user_id, stream):
 """ Push a stream onto the stream stack in cache. :param cache: werkzeug BasicCache-like object :param user_id: id of user, used as key in cache :param stream: stream object to push onto stack :return: True on successful update, False if failed to update, None if invalid input was given """

    stack = cache.get(user_id)
    if stack is None:
        stack = []
    if stream:
        stack.append(stream)
        return cache.set(user_id, stack)
    return None