async def METHOD_NAME(self, request, handler):
    supported_networks = [MAINNET, SCALINGTESTNET, TESTNET, REGTESTNET]
    network = request.match_info.get('network', None)
    # paths without {network} are okay
    if network is None:
        response = await handler(request)
        return response
    # check if supported network
    else:
        if network not in supported_networks:
            code =    Errors.URL_INVALID_NETWORK_CODE
            message = Errors.URL_INVALID_NETWORK_MESSAGE.format(supported_networks, network)
            return bad_request(code, message)
    # check if network matches daemon
    if self.network != network:
        code =    Errors.URL_NETWORK_MISMATCH_CODE
        message = Errors.URL_NETWORK_MISMATCH_MESSAGE.format(self.network, network)
        return bad_request(code, message)
    response = await handler(request)
    return response