def read_dcm_func():
    get_bytes=request.get_data()
    dcm_dicts={}
    dcm_names_str = str(get_bytes, encoding='utf-8')
    dcm_names_dict = json.loads(dcm_names_str)
    for key in dcm_names_dict.keys():
        dcm_name=dcm_names_dict[key]
        print(dcm_name)
        dcm_dict=read_DCM(dcm_name)
        dcm_dicts.update(dcm_dict)
    pprint.pprint(dcm_dicts)
    return jsonify(dcm_dicts)    

def read_DCM(dcm_file):
    this_dcm={}
    with open(dcm_file,'rb') as t:
        tt=t.read()
        tt=str(tt, encoding='utf-8')
        matchObj  =re.findall( 'FESTWERT[\s\S]*?END',tt)
        if matchObj:
            for part in matchObj:
                lines=re.split("\n",part)
                if lines[0]:
                    words=re.split("\s+",lines[0])
                    name=words[1]
                if lines[-2]:
                    words=re.split("\s+",lines[-2])
                    value=words[2]
                this_dcm[name]=eval(value)
    with open(dcm_file,'rb') as t:
        tt=t.read()
        tt=str(tt, encoding='utf-8')
        matchObj  =re.findall( 'KENNLINIE[\S\s]*?END',tt)
        if matchObj:
            for part in matchObj:
                X=[]
                Z=[]
                lines=re.split("\n",part)
                if lines[0]:
                    words=re.split("\s+",lines[0])
                    name=words[1]
                for line in lines:
                    words=re.split("\s+",line)
                    if(len(words)>1):
                        if("ST" in words[1]):
                            for x in words[2:len(words)-1]:
                                X.append(eval(x))
                        if(words[1]=="WERT"):
                            for z in words[2:len(words)-1]:
                                Z.append(eval(z))
                curve={}
                curve['x']=X
                curve['z']=Z
                this_dcm[name]=curve
    return this_dcm