def get_loc_of_cell(cell_name, tile_grid):
    """
    Returns loc of a cell with the given name in the tilegrid.
    """

    # Look for a tile that has the cell
    for loc, tile in tile_grid.items():
        if tile is None:
            continue

        cell_names = [c.name for c in tile.cells]
        if cell_name in cell_names:
            return loc

    # Not found
    return None