def METHOD_NAME(
    channel_slug,
    error_class,
):
    if channel_slug is not None:
        channel = validate_channel(channel_slug, error_class)
    else:
        try:
            channel = get_default_channel()
        except ChannelNotDefined:
            raise ValidationError(
                {
                    "channel": ValidationError(
                        "You need to provide channel slug.",
                        code=error_class.MISSING_CHANNEL_SLUG.value,
                    )
                }
            )
    return channel