def _mask_dict(in_dict, mask):
    """Given a dict and a list of fields removes all fields not in the list"""
    for key in (set(in_dict.keys()) - set(mask)):
        in_dict.pop(key)
    return in_dict
