def channel_filter(channel, channel_spec):
    """
    Utility function to return True iff the given channel matches channel_spec.
    """
    if isinstance(channel_spec, int):
        return channel == channel_spec
    if isinstance(channel_spec, tuple):
        return channel in channel_spec
    raise ValueError("Incorrect type for channel_spec" + str(type(channel_spec)))