def get_database(self, shard, slave=False):
        """
        Given a shard (numeric index value), returns the correct database alias to query against.

        If ``slave`` is True, returns a read-slave.
        """
        try:
            model = self.model._shards.nodes[shard]
        except IndexError:
            raise ValueError((shard, self.model.__name__) % 'Shard %r does not exist on %r')
        return model._shards.get_database(slave=slave)
dataset/ETHPy150Open disqus/sharding-example/sqlshards/db/shards/manager.py/MasterPartitionManager.get_database/swapped operands of `%`