def find_first_fit(unoccupied_columns, row, row_length):
    """
    Finds the first index that the row's items can fit.
    """
    for free_col in unoccupied_columns:
        # The offset is that such that the first item goes in the free column.
        first_item_x = row[0][0]
        offset = free_col - first_item_x
        if check_columns_fit(unoccupied_columns, row, offset, row_length):
            return offset

    raise ValueError("Row cannot bossily fit in %r: %r"
                     % (list(unoccupied_columns.keys()), row))
Finds the first index that the row's items can fit.