def is_occupied(index_i, index_j, tile_arrangement):
    """
    Determines whether the tile at (`index_i`, `index_j`) is occupied.

    Args:
        index_i (int):
            Row index.
        index_j (int):
            Column index.
        tile_arrangement (List[List[str]]):
            Arrangement of the tiles as a 2D grid.

    Returns:
        bool:
            Whether or not the tile is occupied.
    """

    # Validate inputs
    if not (0 <= index_i <= len(tile_arrangement) - 1):
        raise IndexError
    if not (0 <= index_j <= len(tile_arrangement[0]) - 1):
        raise IndexError

    # Check occupancy
    if tile_arrangement[index_i][index_j] == "#":
        return True
    else:
        return False