def mask_headers(headers, masks):
    """
    filters any headers (a dictionary) with key that matches those in the
    masks (a list)
    This have a sideeffect, so please make a deepcopy before using.
    """
    if headers is None:
        return headers
    if masks is None:
        return headers
    for member in masks:
        headers.pop(member, None)
    return headers
