def METHOD_NAME(*,
                        team_collection: TeamCollection,
                        team_name: str,
                        raise_error: bool = False) -> Team:
    """
    Tries to find a team by name (returns first hit).
    If not found, creates a new team with the given name
    """
    if raise_error:
        team = get_by_name_or_raise_error(collection=team_collection, name=team_name)
    else:
        team = get_by_name_or_create(
            collection=team_collection,
            name=team_name,
            default_provider=lambda: team_collection.register(team_name)
        )
    return team