code: def resource_of_node(resources, node):
      
      for resource in resources:
          model = getattr(resource, 'model', None)
          if type(node) == model:
              return resource
      return BasePageResource
docs: Returns resource of node.