<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_resource_access_state(self, request):
 """ Returns the FeinCMS resource's access_state, following any INHERITed values. Will return None if the resource has an access state that should never be protected. It should not be possible to protect a resource with an access_state of STATE_ALL_ALLOWED, or an access_state of STATE_INHERIT and no parent. Will also return None if the accessed URL doesn't contain a Page. """

        feincms_page = self._get_page_from_path(request.path_info.lstrip('/'))
        if not feincms_page:
            return None

        # Chase inherited values up the tree of inheritance.
        INHERIT = AccessState.STATE_INHERIT
        while feincms_page.access_state == INHERIT and feincms_page.parent:
            feincms_page = feincms_page.parent

        # Resources with STATE_ALL_ALLOWED or STATE_INHERIT and no parent should never be
        # access-restricted. This code is here rather than in is_resource_protected to
        # emphasise its importance and help avoid accidentally overriding it.
        never_restricted = (INHERIT, AccessState.STATE_ALL_ALLOWED)
        if feincms_page.access_state in never_restricted:
            return None

        # Return the found value.
        return feincms_page.access_state