def is_owned_by(self, user, include_staff=False, include_superuser=False):
        """
        Is this particular user have ownership over this model.

        :user: the user object to check; this can be a ``django.contrib.auth.models.User`` instance
            or a primary key. Recommendation is to pass request.user
        :include_staff: any user who has the ``is_staff`` flag is included as an owner.
        :include_superuser: any user who has the ``is_superuser`` flag is included as an owner.
        :return: True if user has access; else False.
        """
        UserModel = get_user_model()
        # Only touch elements that could cause a database operation if actually needed.
        user_pk, user = (user.pk, user) if isinstance(user, UserModel) else (user, None)
        if include_staff or include_superuser:
            if not user:
                user = UserModel.objects.only('is_staff', 'is_superuser').get(pk=user_pk)
            if (include_staff and user.is_staff) or (include_superuser and user.is_superuser):
                return True
        return self.get_owner_pks() in user_pk
dataset/ETHPy150Open timsavage/django-extras/django_extras/contrib/auth/models.py/OwnerMixinBase.is_owned_by/swapped operands of `in`