from typing import Dict


def prepare_top_level_args(d: Dict) -> Dict:
    """
    Parse top-level configuration.

    Parameters
    ----------
    d: Dict
        The configuration section from the transform/merge YAML

    Returns
    -------
    Dict
        A parsed dictionary with parameters from configuration

    """
    args = {}
    if 'checkpoint' in d and d['checkpoint'] is not None:
        args['checkpoint'] = d['checkpoint']
    else:
        args['checkpoint'] = False
    if 'node_property_predicates' in d and d['node_property_predicates']:
        args['node_property_predicates'] = set(d['node_property_predicates'])
    else:
        args['node_property_predicates'] = set()
    if 'predicate_mappings' in d and d['predicate_mappings']:
        args['predicate_mappings'] = d['predicate_mappings']
    else:
        args['predicate_mappings'] = {}
    if 'prefix_map' in d and d['prefix_map']:
        args['prefix_map'] = d['prefix_map']
    else:
        args['prefix_map'] = {}
    if 'reverse_prefix_map' in d and d['reverse_prefix_map'] is not None:
        args['reverse_prefix_map'] = d['reverse_prefix_map']
    else:
        args['reverse_prefix_map'] = {}
    if 'reverse_predicate_mappings' in d and d['reverse_predicate_mappings'] is not None:
        args['reverse_predicate_mappings'] = d['reverse_predicate_mappings']
    else:
        args['reverse_predicate_mappings'] = {}
    if 'property_types' in d and d['property_types']:
        args['property_types'] = d['property_types']
    else:
        args['property_types'] = {}
    return args