'Return the (song_id, offset_diff) tuples associated with
a list of (sha1, sample_offset) values.'

def return_matches(self, hashes):

    mapper = {}
    for (hash, offset) in hashes:
        mapper[hash.upper()] = offset
    values = mapper.keys()
    with self.cursor() as cur:
        for split_values in grouper(values, 1000):
            query = self.SELECT_MULTIPLE
            query = (query % ',    '.join((['UNHEX(%s)'] * len(split_values))))
            cur.execute(query, split_values)
            for (hash, sid, offset) in cur:
                (yield (sid, (offset - mapper[hash])))
