code: async def _find_overlap(queries, client, find_method, get_method,
                          overlap_function):
      results = []
      for query in queries:
          candidates = await getattr(client, find_method)(query)
          if not candidates:
              raise ValueError('no result found for {!r}'.format(query))
          result = await getattr(client, get_method)(id_=candidates[0].id_)
          results.append(result)
      return await overlap_function(results, client)