def clean_headers(hdr_tuples, invalid_hdrs=None):
    """
    Given a list of header tuples, filters out tuples with empty header names
    or in the specified invalid header names list.
    """
    if hdr_tuples is None:
        return list()
    clean_tuples = list()
    for entry in hdr_tuples:
        if not entry[0]:
            continue
        name = str(entry[0]).strip().lower()
        value = str(entry[1]) if entry[1] else ''
        if name not in (invalid_hdrs or list()):
            clean_tuples.append((name, value))
    return clean_tuples