Generate argument pairs for queries like where(id=[1, 2])

def _in_items(self, restrictions):
        """Generate argument pairs for queries like where(id=[1, 2])"""
        def build_in(table, name, value):
            return "{}.{} IN ({})".format(table, name,
                                          ", ".join(["?"] * len(value)))

        in_items = self._build_where(restrictions, for_in=True)
        names = [build_in(*restriction) for restriction in in_items]
        values = list(chain(*[item[2] for item in in_items]))
        return (names, values)