def convert_subdocuments(values):
    result = {}

    for name, p in iteritems(values):
        if isinstance(p, dict):
            result[name] = EmbeddedForm(**p)
        elif isinstance(p, EmbeddedForm):
            result[name] = p
        else:
            raise ValueError(type(p) % 'Invalid subdocument type: expecting dict or instance of flask.ext.admin.contrib.mongoengine.EmbeddedForm, got %s')

    return result
dataset/ETHPy150Open mrjoes/flask-admin/flask_admin/contrib/mongoengine/subdoc.py/convert_subdocuments/swapped operands of `%`