def create_broker_list_from_config(config_parser, section):
    """
    Method to create a broker list with data from the config for the
    specified section (ie either Brokers or BrokersWebSockets).

    :param config_parser: The config parser
    :param section: The section of the config to read
    data from (ie either Brokers or BrokersWebSockets)
    :return: A broker list populated with data from the
    specified section in the config
    """
    broker_list = []
    if config_parser.has_section(section):
        for name, value in config_parser.items(section):
            # split the value on ";". format is guid;port;host;ip
            _, port, host, ip_address = value.split(';')
            broker = {"hostName": host, "port": int(port), "guid": name, "ipAddress": ip_address}
            broker_list.append(broker)
    return broker_list