Load the event definitions from yaml config file.

def load_config(filename):
    """Load the event definitions from yaml config file."""
    logger.debug("Event Definitions configuration file: %s", filename)

    with open(filename, 'r') as cf:
        config = cf.read()

    try:
        events_config = yaml.safe_load(config)
    except yaml.YAMLError as err:
        if hasattr(err, 'problem_mark'):
            mark = err.problem_mark
            errmsg = ("Invalid YAML syntax in Event Definitions file "
                      "%(file)s at line: %(line)s, column: %(column)s."
                      % dict(file=filename,
                             line=mark.line + 1,
                             column=mark.column + 1))
        else:
            errmsg = ("YAML error reading Event Definitions file "
                      "%(file)s"
                      % dict(file=filename))
        logger.error(errmsg)
        raise

    logger.info("Event Definitions: %s", events_config)
    return events_config