Check, convert and adjust user passed config

       Given a user configuration it returns a verified configuration with
       all parameters converted to the types that are needed at runtime.

def normalize_conf(conf):
    '''Check, convert and adjust user passed config

       Given a user configuration it returns a verified configuration with
       all parameters converted to the types that are needed at runtime.
    '''
    conf = conf.copy()
    # check for type error
    check_config(conf)
    # convert some fileds into python suitable format
    from_json_format(conf)
    if 'dmode' not in conf:
        conf['dmode'] = calc_dir_mode(conf['fmode'])
    return conf