def get_group(inventory, groupname):
    """Get group from inventory, return group or None."""
    groups = inventory.keys()
    found = None
    for g_name in groups:
        group = inventory[g_name]
        if g_name == groupname:
            found = group
        else:
            if "children" in group:
                found = get_group(group["children"], groupname)
        if found:
            break
    return found