def layer_is_in_mark(layer, mark):
    """
    Whether the given layer is in the given mark.
    """
    return layer["mark"] == mark or ("type" in layer["mark"]
                                     and layer["mark"]["type"] == mark)