def schema_entity_ordered(entity: Mapping[str, Any]) -> Mapping[str, Any]:
    """A copy of JSON schema data reordered into more tidy logical ordering."""
    ordered = OrderedDict()
    keys = set(entity.keys())
    for k in ('$schema', 'title', 'description', 'type', 'items'):
        if k in keys:
            keys.remove(k)
            ordered[k] = entity[k]
    if '$defs' in keys:
        keys.remove('$defs')
        ordered['$defs'] = OrderedDict(
            (k, schema_entity_ordered(v)) for k, v in entity['$defs'].items()
        )
    if 'properties' in keys:
        keys.remove('properties')
        ordered['properties'] = OrderedDict(
            (k, schema_entity_ordered(v))
            for k, v in entity['properties'].items()
        )
    # Include remaining fields in arbitrary order.
    for k in sorted(keys):
        ordered[k] = entity[k]
    return ordered
A copy of JSON schema data reordered into more tidy logical ordering.
gcalcli/config.py