<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_owners(self, request, **resources):
 """ Check parents of current resource. Recursive scanning of the fact that the child has FK to the parent and in resources we have right objects. We check that in request like /author/1/book/2/page/3 Page object with pk=3 has ForeignKey field linked to Book object with pk=2 and Book with pk=2 has ForeignKey field linked to Author object with pk=1. :return bool: If success else raise Exception """


        if self._meta.allow_public_access or not self._meta.parent:
            return True

        self.parent.check_owners(request, **resources)

        objects = resources.get(self._meta.name)
        if self._meta.model and self._meta.parent._meta.model and objects:
            pr = resources.get(self._meta.parent._meta.name)
            check = all(
                pr.pk == getattr(
                    o, "%s_id" % self._meta.parent._meta.name, None)
                for o in as_tuple(objects))

            if not pr or not check:
                # 403 Error if there is error in parent-children relationship
                raise HttpError(
                    "Access forbidden.", status=status.HTTP_403_FORBIDDEN)

        return True