A Dropbox team maintains a shared storage limit. Implement ADD_USER(user_id, capacity) to register a user with a requested storage capacity.
The operation succeeds only when the user ID is not already registered, the capacity is positive, and the team's total assigned capacity does not exceed max_capacity. On success, add the user and return True. On failure, leave the user mapping unchanged and return False.
Implement add_user(users, user_id, capacity, max_capacity).
users is a dictionary mapping user IDs to assigned capacities.user_id is a string.capacity and max_capacity are integers measured in gigabytes.users only after all validation checks pass.The existing dictionary may contain valid users, and its assigned capacities count toward the team's limit.
def add_user(users, user_id, capacity, max_capacity):