code: def create_business_rules(self, hosts, services, hostgroups, servicegroups,
                                macromodulations, timeperiods, running=False):
          # pylint: disable=too-many-locals
          
          cmdcall = getattr(self, 'check_command', None)
  
          # If we do not have a command, we bailout
          if cmdcall is None:
              return
  
          # we get our base command, like
          # bp_rule!(host,svc & host, svc) -> bp_rule
          cmd = cmdcall.call
          elts = cmd.split('!')
          base_cmd = elts[0]
  
          # If it's bp_rule, we got a rule :)
          if base_cmd == 'bp_rule':
              self.got_business_rule = True
              rule = ''
              if len(elts) >= 2:
                  rule = '!'.join(elts[1:])
              # Only (re-)evaluate the business rule if it has never been
              # evaluated before, or it contains a macro.
              if re.match(r"\$[\w\d_-]+\$", rule) or self.business_rule is None:
                  macroresolver = MacroResolver()
                  data = self.get_data_for_checks(hosts)
                  rule = macroresolver.resolve_simple_macros_in_string(rule, data,
                                                                       macromodulations,
                                                                       timeperiods)
                  prev = getattr(self, "processed_business_rule", "")
                  if rule == prev:
                      # Business rule did not changed (no macro was modulated)
                      return
  
                  fact = DependencyNodeFactory(self)
                  node = fact.eval_cor_pattern(rule, hosts, services,
                                               hostgroups, servicegroups, running)
                  self.processed_business_rule = rule
                  self.business_rule = node
docs: Create business rules if necessary (cmd contains bp_rule)
  
          :param hosts: Hosts object to look for objects
          :type hosts: alignak.objects.host.Hosts
          :param services: Services object to look for objects
          :type services: alignak.objects.service.Services
          :param running: flag used in eval_cor_pattern function
          :type running: bool
          :return: None