checks if entries in dictionary are mat-objects. If yes
    todict is called to change them to nested dictionaries

def _check_keys(dictionary):
    """
    checks if entries in dictionary are mat-objects. If yes
    todict is called to change them to nested dictionaries
    """
    for key in dictionary:
        if isinstance(dictionary[key], matlab.mio5_params.mat_struct):
            dictionary[key] = _todict(dictionary[key])
    return dictionary