import os, os.path
from mimetypes import guess_type
from stat import * # ST_SIZE etc

def get_path(obj,path):
    keys = path.split('.')
    for k in keys:
        try:
            obj = obj[k]
        except KeyError:
            return None
    return obj

def get_param(obj,path):
    try:
        obj = obj['parameter']
    except KeyError:
        return None
    return get_path(obj,path)

def set_path(obj,path,value):
	keys = path.split('.')
	for k in keys[:-1]:
		if k not in obj.keys():
			obj[k] = {}
		obj = obj[k]
	obj[keys[-1]] = value

def set_param(obj,path,value):
    if 'parameter' not in obj.keys():
        obj['parameter']={}
    set_path(obj['parameter'],path,value)