def split_loops(edat, key):
    """Makes sure that line and surface loops contain only one loop.

    Surfaces and volumes with holes are instead defined in Surface and Volume
    entries, respectively. Needed because gmsh unrolls geometry in a way, which
    is unusable with OpenCASCADE kernel.

    This function is slow. It does not catch all loops.

    Args:
        edat (dict): extracted geometry data
        key (str): type of geometry
    """
    if key == 'line_loop':
        key2 = 'surface'
    elif key == 'surface_loop':
        key2 = 'volume'
    else:
        raise Exception('can be called only for line_loop or surface_loop')
    for i, item1 in edat[key].items():
        for j, item2 in edat[key].items():
            if i != j and set(item2).issubset(set(item1)):
                for value in item2:
                    item1.remove(value)
                edat[key][i] = item1
                edat[key2][i] = [i, j]
                break
