def layer_from_bulk(struct_bulk,slabmin,slabmax):
    
    """
    Extracts a layer from a layered bulk material.
        
    Parameters
    ----------
    struct_bulk (Structure): Pymatgen Structure object of the layered bulk
    slabmin (float): fractional coord of the bottom of the layer to isolate
    slabmax (float): fractional coord of the top of the layer to isolate
    
    Returns
    -------
    (Structure) Structure object of the single layer.
    
    """

    struct_layer = struct_bulk.copy()    
    not_in_layer = [i for i,site in enumerate(struct_layer.sites) \
                          if site.c < slabmin or site.c > slabmax]    
    struct_layer.remove_sites(not_in_layer)

    return struct_layer