def METHOD_NAME(module):
    if hasattr(module, "_vyos_connection"):
        return module._vyos_connection
    capabilities = get_capabilities(module)
    network_api = capabilities.get("network_api")
    if network_api == "cliconf":
        module._vyos_connection = Connection(module._socket_path)
    else:
        module.fail_json(msg="Invalid connection type %s" % network_api)
    return module._vyos_connection