def filte_dict(_dict, callback):
    """
    >>> from django.conf import settings
    >>> settings.configure()
    >>> d = {"a":1, "b":2, "c":3}
    >>> filte_dict(d, lambda k,v: k != "b")

    :param _dict:
    :param callback:
    :return:
    """
    if not isinstance(_dict, dict):
        raise TypeError('Invalid dict:%s' % _dict)
    rs = {}
    for k, v in _dict.items():
        if callback(k, v):
            rs[k] = v
    return rs
