code: def cancel(self, timeperiods, hosts, services):
          
          if self.ref in hosts:
              item = hosts[self.ref]
          else:
              item = services[self.ref]
          broks = []
          self.is_in_effect = False
          item.scheduled_downtime_depth -= 1
          if item.scheduled_downtime_depth == 0:
              item.raise_cancel_downtime_log_entry()
              item.in_scheduled_downtime = False
              if self.ref in hosts:
                  broks.append(self.get_expire_brok(item.get_name()))
              else:
                  broks.append(self.get_expire_brok(item.host_name, item.get_name()))
          self.del_automatic_comment(item)
          self.can_be_deleted = True
          item.in_scheduled_downtime_during_last_check = True
          # Nagios does not notify on canceled downtimes
          # res.extend(self.ref.create_notifications('DOWNTIMECANCELLED'))
          # Also cancel other downtimes triggered by me
          for downtime in self.activate_me:
              broks.extend(downtime.cancel(timeperiods, hosts, services))
          return broks
docs: Remove ref in scheduled downtime and raise downtime log entry (cancel)
  
          :param hosts: hosts objects to get item ref
          :type hosts: alignak.objects.host.Hosts
          :param services: services objects to get item ref
          :type services: alignak.objects.service.Services
          :return: [], always
          :rtype: list