def dict2channel_data(task_dict):
    """
    Given a task_dictionary (obtained with dict(task))
    will return group_name and channel_data ready to be
    sent to django channel.

    Returned ``channel_data`` (second item of returned tuple) will
    have ``type`` trandformed as follows:

    new_type = <shortname>.<original type with removed dashes>

    Example:

    task_name = 'papermerge.core.tasks.ocr_document_task'
    type = 'task-received'
    will result in newly update type: 'ocrdocumenttask.taskreceived'
    which will map to channels handler ocrdocumenttask_taskreceived
    """

    ret_dict = {}
    orig_type = task_dict.pop('type')
    orig_task_name = task_dict.pop('task_name')

    orig_short_name = orig_task_name.split('.')[-1]
    short_name = orig_short_name.replace('_', '')
    _type = orig_type.replace('-', '')
    new_type = f"{short_name}.{_type}"

    ret_dict['type'] = new_type
    ret_dict.update(task_dict)

    # First item in tuple is django channel group name == task_short
    # Second item in tuple task_dict with new ``type`` key
    return orig_short_name, ret_dict