def clean_dict(mydict, keep_keys=None, rm_keys=None):
    """
    remove unwanted items in dicts
    """
    if keep_keys is not None:
        for k in list(mydict.keys()):
            if k not in keep_keys:
                del mydict[k]
    if rm_keys is not None:
        for k in list(mydict.keys()):
            if k in rm_keys:
                del mydict[k]
