def modules(codes):
    """Iterates over codes and yields barcode moudles as (y, x) tuples."""
    for row_id, row in enumerate(codes):
        col_id = 0
        for value in row:
            for digit in format(value, 'b'):
                if digit == '1':
                    yield col_id, row_id
                col_id += 1
