def _format_lookups(schema: Node, default='Other', strip_form_name=True):
    matching = schema.collect_matching({'has_attr': ['__lookup']})
    if not matching:
        return {}
    if not strip_form_name:
        return {
            key: _format_single_lookup(node, default)
            for key, node in matching
        }
    else:
        return {
            remove_formname(key): _format_single_lookup(node, default)
            for key, node in matching
        }
def _find_timestamp(schema: Node):
    # takes a field matching timestamp, or the first timestamp
    matching = schema.collect_matching(
        {'match_attr': [{
            '__extended_type': 'dateTime'
        }]})
    fields = sorted([remove_formname(key) for key, node in matching])
    timestamps = [f for f in fields if 'timestamp' in f]
    preferred = consumer_config.get('es_options', {}).get('index_time', None)
    if fields and preferred in fields:
        return preferred
    elif timestamps:
        return timestamps[0]
    elif fields:
        return fields[0]
    else:
        return consumer_config.get('es_options',
                                   {}).get('auto_timestamp', None)