<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def is_group_manager(user, group=None):
 """Returns True if user is a group manager either for the group or any group."""

    roles = get_user_roles(user)
    return any(x[1] == TenantRole.ROLE_GROUP_MANAGER and (not group or x[0] == group) for x in roles)