async def METHOD_NAME(
    app: web.Application,
    project_uuid: str,
    user_id: UserID,
    user_primary_gid: GroupID,
    project: dict,
) -> GroupID | None:
    """Goes through the access rights and tries to find a new suitable owner.
    The first viable user is selected as a new owner.
    In order to become a new owner the user must have write access right.
    """
    access_rights = project["accessRights"]
    # A Set[str] is prefered over Set[int] because access_writes
    # is a Dict with only key,valus in {str, None}
    other_users_access_rights: set[str] = set(access_rights.keys()) - {
        f"{user_primary_gid}"
    }
    _logger.debug(
        "Processing other user and groups access rights '%s'",
        other_users_access_rights,
    )
    # Selecting a new project owner
    # divide permissions between types of groups
    standard_groups = {}  # groups of users, multiple users can be part of this
    primary_groups = {}  # each individual user has a unique primary group
    for other_gid in other_users_access_rights:
        group: RowProxy | None = await get_group_from_gid(app=app, gid=int(other_gid))
        # only process for users and groups with write access right
        if group is None:
            continue
        if access_rights[other_gid]["write"] is not True:
            continue
        if group.type == GroupType.STANDARD:
            standard_groups[other_gid] = access_rights[other_gid]
        elif group.type == GroupType.PRIMARY:
            primary_groups[other_gid] = access_rights[other_gid]
    _logger.debug(
        "Possible new owner groups: standard='%s', primary='%s'",
        standard_groups,
        primary_groups,
    )
    new_project_owner_gid = None
    # the primary group contains the users which which the project was directly shared
    if len(primary_groups) > 0:
        # fetch directly from the direct users with which the project is shared with
        new_project_owner_gid = int(list(primary_groups.keys())[0])
    # fallback to the groups search if the user does not exist
    if len(standard_groups) > 0 and new_project_owner_gid is None:
        new_project_owner_gid = await _fetch_new_project_owner_from_groups(
            app=app,
            standard_groups=standard_groups,
            user_id=user_id,
        )
    _logger.info(
        "Will move project '%s' to user with gid '%s', if user exists",
        project_uuid,
        new_project_owner_gid,
    )
    return new_project_owner_gid