def validate_dict(template, to_be_checked, parent, missing_log, extras_log):
    """
    Given a dictionary as a template will check that the to_be_checked
    dictionary.
    """
    for k in to_be_checked:
        k = k.strip()
        if not k in template:
            extras_log.append("Field %r in record %r" % (k, parent))
    for k in template:
        k = k.strip()
        if not k in to_be_checked:
            missing_log.append("Field %r in record %r" % (k, parent))
    for key, val in template.iteritems():
        if isinstance(val, dict):
            # check the inner dictionary
            validate_dict(val, to_be_checked[key], parent, missing_log, extras_log)
dataset/ETHPy150Open fluidinfo/flimp/flimp/utils.py/validate_dict/original