Given a log, how would you track consecutive login attempts for one specific user, and then how would you extend it to track consecutive attempts for all users?
Assume the log is ordered chronologically and each record is [user_id, success], where success is a Boolean. Return the maximum consecutive failed-login streak for the requested user, or a dictionary containing that value for every user when no user is specified.
Use def track_consecutive_attempts(log, user_id=None):.
def track_consecutive_attempts(log, user_id=None):