def count_cpus(users, host, pbsnodes):
    """
    See how many cpu's are actually free
    """
    nodeSum = {'R': 0, 'Q': 0, 'W': 0, 'O': 0, 'used_cpu': 0, 'H': 0}
    for uid in users:
        try:
            nodeSum['R'] = len(users[uid]['nodes'])
        except KeyError:
            nodeSum['R'] = users[uid]['R']
        nodeSum['Q'] += users[uid]['Q']
        nodeSum['W'] += users[uid]['W']
        nodeSum['H'] += users[uid]['H']
        nodeSum['used_cpu'] += users[uid]['cpus']
        nodeSum['O'] += users[uid]['E'] + users[uid]['T'] + users[uid]['S'
            ] + users[uid]['O'] + users[uid]['C']
    down_cpu = host['cpu_per_node'] * pbsnodes['down']
    total_cpu = host['cpu_per_node'] * pbsnodes['nr_nodes']
    cpu_free = total_cpu - down_cpu - nodeSum['used_cpu']
    return cpu_free, nodeSum
