Seems like a lot of the `get_group_id`, `get_owner_username` calls could be replaced with variables defined at the beginning of the loop which would make the code simpler to read.