code: def load_rules(self, filename):
          
          self.logger.debug('Reading rules from %s', filename)
          try:
              in_file = open(filename)
          except IOError:
              self.logger.error('Error opening {0}'.format(filename))
              raise
  
          y = None
          try:
              y = yaml.load(in_file)
          except yaml.YAMLError as exc:
              if hasattr(exc, 'problem_mark'):
                  self.logger.error('Error parsing rules{0}'.format(exc.problem_mark))
  
              else:
                  self.logger.error('Error parsing rules in {0}'.format(in_file.name))
              raise
          return y
docs: Load rules from YAML configuration in the given stream object
          :param filename: Filename of rule YAML file
          :return: rules object