def motor_mne(hd):
    """
    expands the _mne and _pos header items of edf headers
    """
    h = {}
    order = []
    for line in hd.split(';'):
        try:
            key, vals = line.split('=')
        except ValueError:
            continue
        key = key.lstrip().rstrip()
        h[key] = vals.split(';')[0]
        order.append(key)
    for k in order:
        if k.endswith('_mne'):
            stem = k.split('_')[0]
            p = k.replace('_mne', '_pos')
            newkeys = h[k].split()
            newvals = h[p].split()
            for ik, iv in zip(newkeys, newvals):
                kk = stem + ':' + ik
                h[kk] = iv
                order.append(kk)
    return h, order
