def firebase_stats(firebase):
    """
    Returns two dictionaries.
    The first with the user names as keys and the respective user recycling count as values.
    It will look like this:
    {'frank': 91, 'grace': 169, 'ken': 145, 'shelly': 103, 'tim': 112}
    The second dictionary has the recycling categories as keys and the respective category count as values.
    It will look like this:
    {'bottles': 229, 'cans': 205, 'others': 186}
    """
    data = firebase.get()
    by_user_count = {user: sum(data[user].values()) for user in data.keys()}
    by_category_count = {}

    for user in data:
        for category in data[user]:
            if category not in by_category_count:
                by_category_count[category] = data[user][category]
            else:
                by_category_count[category] += data[user][category]

    return by_user_count, by_category_count