import json


def _filter_serializable(filter_me: dict) -> dict:
    """
    Helper function that will remove elements from a dictionary that are not JSON serializable.

    :param filter_me:  Dictionary that has elements which may be filtered.
    :return:  The original dictionary without elements that are not JSON serializable.
    """
    #  Use recursion to filter nested dictionary elements
    rv = {}
    for k, v in filter_me.items():
        try:
            json.dumps(v)
        except Exception:
            try:
                iter(v)  # test if its iterable
                v = _filter_serializable(v)  # if so, filter it
            except Exception:
                continue

        rv.update({k: v})

    return rv