code: def no_loop_in_parents(self, attr1, attr2):
          # pylint: disable=too-many-branches
          
          # Ok, we say "from now, no loop :) "
          # in_loop = []
  
          # Create parent graph
          parents = Graph()
  
          # Start with all items as nodes
          for item in self:
              # Hack to get self here. Used when looping on host and host parent's
              if attr1 == "self":
                  obj = item.uuid          # obj is a host/service [list]
              else:
                  obj = getattr(item, attr1, None)
              if obj is not None:
                  if isinstance(obj, list):
                      for sobj in obj:
                          parents.add_node(sobj)
                  else:
                      parents.add_node(obj)
  
          # And now fill edges
          # pylint: disable=too-many-nested-blocks
          for item in self:
              if attr1 == "self":
                  obj1 = item.uuid
              else:
                  obj1 = getattr(item, attr1, None)
              obj2 = getattr(item, attr2, None)
              if obj2 is not None:
                  if isinstance(obj2, list):
                      for sobj2 in obj2:
                          if isinstance(obj1, list):
                              for sobj1 in obj1:
                                  parents.add_edge(sobj1, sobj2)
                          else:
                              parents.add_edge(obj1, sobj2)
                  else:
                      if isinstance(obj1, list):
                          for sobj1 in obj1:
                              parents.add_edge(sobj1, obj2)
                      else:
                          parents.add_edge(obj1, obj2)
  
          return parents.loop_check()
docs: Find loop in dependencies.
          For now, used with the following attributes :
          :(self, parents):
              host dependencies from host object
          :(host_name, dependent_host_name):\
              host dependencies from hostdependencies object
          :(service_description, dependent_service_description):
              service dependencies from servicedependencies object
  
          :param attr1: attribute name
          :type attr1: str
          :param attr2: attribute name
          :type attr2: str
          :return: list
          :rtype: list