def number(loc, state, multiplier=1):
    """number operator; equivalent to a.dag a  or sigma.dag sigma
    Args:
        loc: (cavity, emitter) tuple
        state: basis state given as list of quants locs
        multiplier: scaler
    Returns (state, val * multiplier) where val is the number of quanta at
    loc = (cavity, emitter)"""
    
    n = state.count(loc) #len([1 for quanta in state if quanta == loc])
    if n == 0 or multiplier == 0:
        return ([], 0)
    return (state, n * multiplier)