def merge_validator_config(configs):
    """
    Given a list of ValidatorConfig objects, merges them into a single
    ValidatorConfig, giving priority in the order of the configs
    (first has highest priority).
    """
    bind_network = None
    bind_component = None
    bind_consensus = None
    endpoint = None
    peering = None
    seeds = None
    peers = None
    network_public_key = None
    network_private_key = None
    scheduler = None
    permissions = None
    roles = None
    opentsdb_url = None
    opentsdb_db = None
    opentsdb_username = None
    opentsdb_password = None
    minimum_peer_connectivity = None
    maximum_peer_connectivity = None
    state_pruning_block_depth = None
    fork_cache_keep_time = None
    component_thread_pool_workers = None
    network_thread_pool_workers = None
    signature_thread_pool_workers = None

    for config in reversed(configs):
        if config.bind_network is not None:
            bind_network = config.bind_network
        if config.bind_component is not None:
            bind_component = config.bind_component
        if config.bind_consensus is not None:
            bind_consensus = config.bind_consensus
        if config.endpoint is not None:
            endpoint = config.endpoint
        if config.peering is not None:
            peering = config.peering
        if config.seeds is not None:
            seeds = config.seeds
        if config.peers is not None:
            peers = config.peers
        if config.network_public_key is not None:
            network_public_key = config.network_public_key
        if config.network_private_key is not None:
            network_private_key = config.network_private_key
        if config.scheduler is not None:
            scheduler = config.scheduler
        if config.permissions is not None or config.permissions == {}:
            permissions = config.permissions
        if config.roles is not None:
            roles = config.roles
        if config.opentsdb_url is not None:
            opentsdb_url = config.opentsdb_url
        if config.opentsdb_db is not None:
            opentsdb_db = config.opentsdb_db
        if config.opentsdb_username is not None:
            opentsdb_username = config.opentsdb_username
        if config.opentsdb_password is not None:
            opentsdb_password = config.opentsdb_password
        if config.minimum_peer_connectivity is not None:
            minimum_peer_connectivity = config.minimum_peer_connectivity
        if config.maximum_peer_connectivity is not None:
            maximum_peer_connectivity = config.maximum_peer_connectivity
        if config.state_pruning_block_depth is not None:
            state_pruning_block_depth = config.state_pruning_block_depth
        if config.fork_cache_keep_time is not None:
            fork_cache_keep_time = config.fork_cache_keep_time
        if config.component_thread_pool_workers is not None:
            component_thread_pool_workers = \
                config.component_thread_pool_workers
        if config.network_thread_pool_workers is not None:
            network_thread_pool_workers = \
                config.network_thread_pool_workers
        if config.signature_thread_pool_workers is not None:
            signature_thread_pool_workers = \
                config.signature_thread_pool_workers

    return ValidatorConfig(
        bind_network=bind_network,
        bind_component=bind_component,
        bind_consensus=bind_consensus,
        endpoint=endpoint,
        peering=peering,
        seeds=seeds,
        peers=peers,
        network_public_key=network_public_key,
        network_private_key=network_private_key,
        scheduler=scheduler,
        permissions=permissions,
        roles=roles,
        opentsdb_url=opentsdb_url,
        opentsdb_db=opentsdb_db,
        opentsdb_username=opentsdb_username,
        opentsdb_password=opentsdb_password,
        minimum_peer_connectivity=minimum_peer_connectivity,
        maximum_peer_connectivity=maximum_peer_connectivity,
        state_pruning_block_depth=state_pruning_block_depth,
        fork_cache_keep_time=fork_cache_keep_time,
        component_thread_pool_workers=component_thread_pool_workers,
        network_thread_pool_workers=network_thread_pool_workers,
        signature_thread_pool_workers=signature_thread_pool_workers
    )
Given a list of ValidatorConfig objects, merges them into a single
    ValidatorConfig, giving priority in the order of the configs
    (first has highest priority).