def check_network_exists(conn, networkname, logger):
    """ check if the network exists, may or may not be active """
    network_names = conn.listNetworks()
    network_names += conn.listDefinedNetworks()
    if networkname not in network_names:
        logger.error("%s doesn't exist" % networkname)
        return False
    else:
        return True
