def _check_if_field_is_excluded(
        self, prefix: str, field: "ForeignKeyField", is_through: bool
    ) -> bool:
        """
        Checks if given relation is excluded in current query.

        Note that in contrary to other queryset methods here you can exclude the
        in-between models but keep the end columns, which does not make sense
        when parsing the raw data into models.

        So in relation category -> category_x_post -> post -> user you can exclude
        category_x_post and post models but can keep the user one. (in ormar model
        context that is not possible as if you would exclude through and post model
        there would be no way to reach user model).

        Exclusions happen on a model before the current one, so we need to move back
        in chain of model by one or by two (m2m relations have through model in between)

        :param prefix: table alias
        :type prefix: str
        :param field: field with relation
        :type field: ForeignKeyField
        :param is_through: flag if current table is a through table
        :type is_through: bool
        :return: result of the check
        :rtype: bool
        """
        shift, field_name = 1, field.name
        if is_through:
            field_name = field.through.get_name()
        elif field.is_multi:
            shift = 2
        previous_excludable = self._get_previous_excludable(
            prefix=prefix, field=field, shift=shift
        )
        return previous_excludable.is_excluded(field_name)

        Checks if given relation is excluded in current query.

        Note that in contrary to other queryset methods here you can exclude the
        in-between models but keep the end columns, which does not make sense
        when parsing the raw data into models.

        So in relation category -> category_x_post -> post -> user you can exclude
        category_x_post and post models but can keep the user one. (in ormar model
        context that is not possible as if you would exclude through and post model
        there would be no way to reach user model).

        Exclusions happen on a model before the current one, so we need to move back
        in chain of model by one or by two (m2m relations have through model in between)

        :param prefix: table alias
        :type prefix: str
        :param field: field with relation
        :type field: ForeignKeyField
        :param is_through: flag if current table is a through table
        :type is_through: bool
        :return: result of the check
        :rtype: bool
        
ormar/queryset/reverse_alias_resolver.py