def opt_dict_param(obj, param_name, key_type=None, value_type=None, value_class=None):
    '''Ensures argument obj is either a dictionary or None; if the latter, instantiates an empty
    dictionary.
    '''
    if obj is not None and not isinstance(obj, dict):
        raise_with_traceback(_param_type_mismatch_exception(obj, dict, param_name))

    if not obj:
        return {}

    if value_class:
        return _check_key_value_types(obj, key_type, value_type=value_class, value_check=issubclass)
    return _check_key_value_types(obj, key_type, value_type)
Ensures argument obj is either a dictionary or None; if the latter, instantiates an empty
    dictionary.