def channels_length(sequence_shape, data_format: str='channels_last') ->int:
    """Returns sequence.shape[-1] or [0] depending on data_format."""
    if data_format is None:
        data_format = 'channels_last'
    return (sequence_shape[0],) if data_format == 'channels_last' else (
        sequence_shape[-1],)
