def debug_channel(mdf, group, channel, dependency, file=None):
    """ use this to print debug information in case of errors

    Parameters
    ----------
    mdf : MDF
        source MDF object
    group : dict
        group
    channel : Channel
        channel object
    dependency : ChannelDependency
        channel dependency object

    """
    print('MDF', '=' * 76, file=file)
    print('name:', mdf.name, file=file)
    print('version:', mdf.version, file=file)
    print('read fragment size:', mdf._read_fragment_size, file=file)
    print('write fragment size:', mdf._write_fragment_size, file=file)
    print()
    parents, dtypes = mdf._prepare_record(group)
    print('GROUP', '=' * 74, file=file)
    print('sorted:', group['sorted'], file=file)
    print('data location:', group['data_location'], file=file)
    print('data blocks:', group.data_blocks, file=file)
    print('dependencies', group['channel_dependencies'], file=file)
    print('parents:', parents, file=file)
    print('dtypes:', dtypes, file=file)
    print(file=file)
    cg = group['channel_group']
    print('CHANNEL GROUP', '=' * 66, file=file)
    print(cg, cg.cycles_nr, cg.samples_byte_nr, cg.invalidation_bytes_nr,
        file=file)
    print(file=file)
    print('CHANNEL', '=' * 72, file=file)
    print(channel, file=file)
    print(file=file)
    print('CHANNEL ARRAY', '=' * 66, file=file)
    print(dependency, file=file)
    print(file=file)
