def METHOD_NAME(train_partitions, val_partitions):
    """Return a function to construct a client.
    The VirtualClientEngine will exectue this function whenever a client is sampled by
    the strategy to participate.
    """
    def client_fn(cid: str) -> fl.client.Client:
        """Construct a FlowerClient with its own dataset partition."""
        # Extract partition for client with id = cid
        trainset, valset = train_partitions[int(cid)], val_partitions[int(cid)]
        # Create and return client
        return FlowerClient(trainset, valset)
    return client_fn