def _check_channel(channel):
    """Internal function to make sure channel is allowed (either 1,2 or all)"""

    try:
        assert channel.lower() in [
            "1",
            "2",
            "all",
        ], 'Channel must be in [1,2,"all"], not {}'.format(channel)
        return channel.lower()

    except AttributeError:
        assert channel in [1, 2], 'Channel must be in [1,2,"all"], not {}'.format(
            channel
        )
        return channel