def calculate_cells(anchor_point_list_dict, cell_size_meters, utm_bounds=[]):
    """ Calculate boundaries for image cells (chips) from anchor points.

    This function takes the output from :func:`calculate_anchor_points` as well
    as a desired cell size (`cell_size_meters`) and outputs
    ``(W, S, E, N)`` tuples for generating cells.

    Arguments
    ---------
    anchor_point_list_dict : dict
        Output of :func:`calculate_anchor_points`. See that function for
        details.
    cell_size_meters : int or float
        Desired width and height of each cell in meters.
    utm_bounds : list -like of float s, optional
        A :obj:`list`-like of shape ``(W, S, E, N)`` that defines the limits
        of an input image tile in UTM coordinates to ensure that no cells
        extend beyond those limits. If not provided, all cells will be included
        even if they extend beyond the UTM limits of the source imagery.

    Returns
    -------
    cells_list_dict : dict of list(s) of lists
        A dict whose keys are either ``0`` or ``[0, 1, 2, 3]`` (see
        :func:`calculate_anchor_points` . ``quad_space`` ), and whose values are
        :obj:`list` s of boundaries in the shape ``[W, S, E, N]`` . Boundaries
        are in UTM coordinates.

    """
    cells_list_dict = {}
    for anchor_point_list_id, anchor_point_list in anchor_point_list_dict.items():
        cells_list = []
        for anchor_point in anchor_point_list:
            if utm_bounds:
                if (anchor_point[0] + cell_size_meters < utm_bounds[2]) and (
                        anchor_point[1] + cell_size_meters < utm_bounds[3]):
                    cells_list.append([anchor_point[0], anchor_point[1],
                                       anchor_point[0] + cell_size_meters,
                                       anchor_point[1] + cell_size_meters])
                else:
                    pass
            else:  # include it regardless of extending beyond bounds
                cells_list.append([anchor_point[0], anchor_point[1],
                                   anchor_point[0] + cell_size_meters,
                                   anchor_point[1] + cell_size_meters])

        cells_list_dict[anchor_point_list_id] = cells_list

    return cells_list_dict