def METHOD_NAME(mock_shard_allocation):
    allocations_by_db = {
        allocation['_id']: ShardAllocationDoc.wrap(allocation)
        for allocation in mock_shard_allocation
    }
    def _mock_get_shard_allocation(config, db_name, create=False):
        return allocations_by_db[db_name]
    return _mock_get_shard_allocation