def METHOD_NAME(username):
    """
    Get a user by username or raise an error if not found
    :param username: Username
    :type username: str
    :return: User
    :rtype: ~integreat_cms.cms.models.users.user.User
    """
    try:
        return get_user_model().objects.get(username=username)
    except get_user_model().DoesNotExist as e:
        raise CommandError(f'User with username "{username}" does not exist.') from e