def check_all_same_schema_for_keys(schemas, keys, name):
    """Check the list of schemas are the same on the given keys."""
    if len(schemas) == 0:
        return

    head = None
    keys = set(keys)
    for i, schema in enumerate(schemas):
        if not keys.issubset(schema.keys()):
            raise DGLError(
                "Expect all graphs to have keys {} on {}, "
                "but graph {} got keys {}.".format(keys, name, i, schema.keys())
            )

        if head is None:
            head = {k: schema[k] for k in keys}
        else:
            target = {k: schema[k] for k in keys}
            if target != head:
                raise DGLError(
                    "Expect all graphs to have the same schema for keys {} on {}, "
                    "but graph {} got \n\t{}\n which is different from\n\t{}.".format(
                        keys, name, i, target, head
                    )
                )
Check the list of schemas are the same on the given keys.
python/dgl/utils/checks.py