code: def linkify_h_by_hd(self, hosts):
          
          for hostdep in self:
              # Only used for debugging purpose when loops are detected
              setattr(hostdep, "host_name_string", "undefined")
              setattr(hostdep, "dependent_host_name_string", "undefined")
  
              # if the host dep conf is bad, pass this one
              if getattr(hostdep, 'host_name', None) is None or\
                      getattr(hostdep, 'dependent_host_name', None) is None:
                  continue
  
              if hostdep.host_name not in hosts or hostdep.dependent_host_name not in hosts:
                  continue
  
              hosts.add_act_dependency(hostdep.dependent_host_name, hostdep.host_name,
                                       hostdep.notification_failure_criteria,
                                       getattr(hostdep, 'dependency_period', ''),
                                       hostdep.inherits_parent)
  
              hosts.add_chk_dependency(hostdep.dependent_host_name, hostdep.host_name,
                                       hostdep.execution_failure_criteria,
                                       getattr(hostdep, 'dependency_period', ''),
                                       hostdep.inherits_parent)
  
              # Only used for debugging purpose when loops are detected
              setattr(hostdep, "host_name_string", hosts[hostdep.host_name].get_name())
              setattr(hostdep, "dependent_host_name_string",
                      hosts[hostdep.dependent_host_name].get_name())
docs: Add dependency in host objects
          :param hosts: hosts list
          :type hosts: alignak.objects.host.Hosts
  
          :return: None